Thorn
Spriting since 2013
Hello guys, i have tfs 1.2 and i get this silly error but i cant fix it, well this is the script:
and this is the error:
plz help
LUA:
local rewards = {
{itemid = 28783, count = 1},
}
function onThink(interval, lastExecution)
local players = Game.getPlayers()
if #players > 0 then
while true do
local player = players[math.random(#players)]
if not player:hasAccess() and player:getAccountType() == ACCOUNT_TYPE_NORMAL then
local reward = rewards[#rewards]
local item = player:addItem(reward.itemid, math.random(reward.count))
local itemName = item:getCount() > 1 and item:getPluralName() or item:getName()
Game.broadcastMessage(('[LOTTERY] %s has won %d %s, next lottery in 24 hours'):format(player:getName(), item:getCount(), itemName), MESSAGE_STATUS_CONSOLE_ORANGE)
break
end
end
return true
end
and this is the error:
Code:
[Warning - Event::checkScript] Can not load script: scripts/lottery.lua
data/globalevents/scripts/lottery.lua:19: 'end' expected (to close 'function' at line 5) near <eof>
plz help

Last edited by a moderator: