• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent Compensation for the players. (Mass kick / Crash).

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,664
Reaction score
125
Location
Warsaw, Poland
I would like to present a script that I wrote for my own needs.

You can use it if the player died at a time when it was lagg or server crash, and the players lost their levels, you can also add here your items as cash compensation, or simply items you can customize it to your liking.

login.lua

PHP:
registerCreatureEvent(cid, "bug")

creaturescripts.xml :

PHP:
<event type="login" name="bug" event="script" value="bug.lua"/>

Creaturescripts / bug.lua :

Lua:
function onLogin(cid)
		local how = db.getResult("SELECT COUNT(*) FROM `player_deaths` WHERE `player_id`= " .. getPlayerGUID(cid) .. " AND `date`>1349970316 AND `date`<1349977234	;")
		local exp = getPlayerExperience(cid) / 100
		local exp2 = exp * how:getDataInt("COUNT(*)")
	if getPlayerStorageValue(cid, 29851) == -1 and (how:getDataInt("COUNT(*)")) >= 1 then
		setPlayerStorageValue(cid, 29851, 1)
		doPlayerAddExperience(cid, exp2 )
		doPlayerSendTextMessage(cid,22,"You have recived "..exp2.." experience for mass kicks (You died "..how:getDataInt("COUNT(*)").." time) ! ")
	end
return true
end

Settings are there:


local how = db.getResult("SELECT COUNT(*) FROM `player_deaths` WHERE `player_id`= " .. getPlayerGUID(cid) .. " AND `date`>1349970316 AND `date`<1349977234 ;")



The variables you can get from your database (player_deaths) and check when was the first mass kick and when it lasted for.



For example all players who died from 1349970316 to 1349977234 will recive the experience, if the player had 500 milion experience and he died (he lost about 1%), and my system will count how he died and when he died for example 2 times he will recive 2% of him experience, 3 times will recive 3% etc.

TESTED ON 0.4

I hope this can help somebody.
 
Back
Top