Hello, I need help with elseif in a rewardchest that opens every 10 minutes.
It works 100% with 3 if(), but when I add elseif it gets error. Here's code:
Nvm, fixed, needed to delete end after if() and after first elseif()
It works 100% with 3 if(), but when I add elseif it gets error. Here's code:
Code:
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getGlobalStorageValue(5536) == 0) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You got a chest reward!")
doPlayerAddItem(cid, 2000, 1)
setGlobalStorageValue(5535, 0)
end
elseif(getGlobalStorageValue(5535) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "There's still " .. round((getGlobalStorageValue(5536))/1000/60, 0) .. " minutes left until you can take the reward.")
end
elseif(getGlobalStorageValue(5535) == 0) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "A timer on rewardchest has started, when 10 minutes has passed, you or someone else will take the chest reward.")
setGlobalStorageValue(5535, 1)
setGlobalStorageValue(5536, 60*1000*10)
end
return true
end
Nvm, fixed, needed to delete end after if() and after first elseif()
Last edited by a moderator: