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
creaturescripts.xml :
Creaturescripts / bug.lua :
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.
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.