function onSay(cid, words, param)
config = {
level=10, -- level necessary to reborn.
nLvl=8, -- that level will be after reborn.
skull="yes", -- players with white skull can reborn? ("yes" or "no").
redskull="yes", -- players with red skull can reborn? ("yes" or "no").
prot="yes", -- players need to be in protection zone to reborn? ("yes" or "no").
bat="yes", --Players must be no fight to reborn ("yes" or "no").
storage=1030, -- storage for reborn.
reborntimes=2 -- times to be reborn.
}
function getResets(cid)
reset = getPlayerStorageValue(cid,config.storage)
if reset < 0 then
reset = 0
end
return reset
end
if(config.skull == "no") and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid,22,"only players without white skull can reset.")
return TRUE
end
if(config.redskull == "no") and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid,22,"only player without red skull can reset.")
return TRUE
end
if(config.prot == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"you need stay in PZ to reset.")
return TRUE
end
if(config.bat == "yes") and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"players without battle can reset.")
return TRUE
end
if getPlayerStorageValue(cid, config.storage) == config.reborntimes then
doPlayerSendTextMessage(cid,22,"You can't reborn more then "..config.reborntimes.." times.")
return TRUE
end
if getPlayerLevel(cid) >= config.level then
doPlayerAddExp(cid, getExperienceForLevel(config.nLvl)-(getPlayerExperience(cid)))
setPlayerStorageValue(cid,config.storage,getResets(cid)+1)
doPlayerSetNameDescription(cid, " Have reborn "..getResets(cid).." times.")
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "you have reborn "..getResets(cid).." times now and got better")
doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid)-getCreatureMana(cid))
doPlayerSetVocation(cid,getPlayerVocation(cid)+4)
else
doPlayerSendCancel(cid, "You need to have level "..config.level.." or more you may be reset.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return TRUE
end