MaR0
Banned User
- Joined
- Apr 16, 2018
- Messages
- 272
- Solutions
- 3
- Reaction score
- 29
Hello i'm trying to add this script to my server it's globalevent with think type "lottery system"
while i try to launch my server this error comes.. i'm using tfs 1.2 ninja sources 8.00
here is the script
while i try to launch my server this error comes.. i'm using tfs 1.2 ninja sources 8.00
Code:
[Error - GlobalEvent::configureEvent] Missing name for a globalevent
[Warning - BaseEvents::loadFromXml] Failed to configure event
Lua:
local rewards = {
{itemid = 2160, count = 100},
{itemid = 24774, count = 5}
}
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 30 minutes'):format(player:getName(), item:getCount(), itemName), MESSAGE_STATUS_CONSOLE_ORANGE)
break
end
end
end
return true
end
XML:
<globalevent type="think" interval="3500000" script="lottery.lua"/>