I use this scrípt and when some1 gets level 55 and die he returns to level 50 instead of lossign some % and be level 54 ;/
local function getStats(cid, _v)
if _v == "health" then
return isKnight(cid) and getPlayerLevel(cid) * 15 + 65 or isPaladin(cid) and getPlayerLevel(cid) * 10 + 105 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 5 + 145
elseif _v == "mana" then
return isKnight(cid) and getPlayerLevel(cid) * 5 - 5 or isPaladin(cid) and getPlayerLevel(cid) * 15 - 85 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 30 - 205
end
end
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandle r'))
}
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
if getPlayerName(cid) ~= "Account Manager" then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
for i = 1, 5 do
doPlayerAddBlessing(cid, i)
end
doPlayerAddPremiumDays(cid, 2)
doPlayerSetPromotionLevel(cid, 1)
end
end
if getPlayerLevel(cid) < 50 then
doPlayerAddExp(cid, getExperienceForLevel(50))
setCreatureMaxHealth(cid, getStats(cid, "health"))
setCreatureMaxMana(cid, getStats(cid, "mana"))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), false)
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid), false)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "FragReward")
registerCreatureEvent(cid, "Lowpvp")
return true
end