Hi,
I'm using !bless on my ots and sometimes works, and sometimes he bug and if player die he go back to level 1.
Check it please,
Where is the problem? :S
I'm using !bless on my ots and sometimes works, and sometimes he bug and if player die he go back to level 1.
Check it please,
LUA:
-- !blessing by artofwork
local bless = {1, 2, 3, 4, 5}
local cost = 50000
local maxlevel = 50000
function onSay(cid, words, param)
local lvl = getPlayerLevel(cid)
local new_cost = (lvl * cost) / 500
local target = getPlayerGUID(cid)
for i = 1, table.maxn(bless) do
if(getPlayerBlessing(cid, bless[i])) then
doPlayerSendCancel(cid, "You have already have been blessed.")
return TRUE
end
end
if (getPlayerLevel(cid) >= maxlevel) then
if(doPlayerRemoveMoney(cid, new_cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
doPlayerSendTextMessage(cid,22,"You have been successfully blessed.!")
end
else
doPlayerPopupFYI(cid, "You need "..new_cost.." to buy blessings.")
end
elseif(getPlayerLevel(cid) < maxlevel) then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
end
doPlayerPopupFYI(cid, "You have successfully been blessed.")
else
doPlayerPopupFYI(cid, "You need to have "..cost.."gp to buy blessings.")
end
end
return FALSE
end
Where is the problem? :S