• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

problem whit autobroadcast

mimus

New Member
Joined
Mar 14, 2012
Messages
168
Reaction score
2
hello every one! well im using this bc


Code:
local t, i = {"test", "testing", "test123"}, 1

function onThink(interval)
    broadcastMessage(t[i], MESSAGE_STATUS_WARNING)
    i = i == #t and 1 or i + 1
    return true
end

but im getting this error


Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/broadcast.lua:onThink
data/globalevents/scripts/broadcast.lua:4: attempt to call global 'broadcastMessage' (a nil value)
stack traceback:
    [C]: in function 'broadcastMessage'
    data/globalevents/scripts/broadcast.lua:4: in function <data/globalevents/scripts/broadcast.lua:3>
[Error - GlobalEvents::think] Failed to execute event: Broadcast




can you helpme to get it work?
 
Change broadcastMessage(t, MESSAGE_STATUS_WARNING) to
Code:
for _, player in ipairs(Game.getPlayers()) do
     player:sendTextMessage(MESSAGE_STATUS_WARNING, t[i])
end
 
Back
Top