Grehy
Killroy
Code:
local bless = {1, 2, 3, 4, 5}
local maxlevel = 1000000000
local maxlevel = 45
local cost = 50000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lvl = getPlayerLevel(cid)
local new_cost = 50000
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(item.itemid == 1946) then
doTransformItem(item.uid, item.itemid - 1)
end
if (getPlayerLevel(cid) >= maxlevel) then
if(doPlayerRemoveMoney(cid, new_cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerPopupFYI(cid, "You have been successfully blessed!")
doPlayerAddBlessing(cid, bless[i])
doSendMagicEffect(toPosition, CONST_ME_FIREWORK_BLUE)
end
else
doPlayerPopupFYI(cid, "It costs 50,000 gold coins to be blessed.")
end
elseif(getPlayerLevel(cid) < maxlevel) then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerPopupFYI(cid, "You have been successfully blessed!")
doPlayerAddBlessing(cid, bless[i])
doSendMagicEffect(toPosition, CONST_ME_FIREWORK_BLUE)
end
else
doPlayerPopupFYI(cid, "It costs 50,000 gold coins to be blessed.")
end
end
return FALSE
end
It doesn't check to transform the lever back to 1945, and I don't understand why theres a max level. And the main thing is when it sends the FYI message, it sends it 5 times for some reason so I have to click OK 5 times to make it go away. I tried moving the popup message earlier in the list of events it does but it doesn't make a difference, it still sends it 5 times. If anyone could help me fix this it would be great