• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.0 Autobroadcast

7804364

Member
Joined
Mar 6, 2010
Messages
457
Reaction score
10
Ok so my autobroadcast wont broadcast anything

<globalevent name="say" interval="60000" script="broad.lua"/>

function onThink(interval, lastExecution)
MENSAGEM = {
"Dont forget to donate!",
"If you want to buy addons use, !addon",
"Random Dungeon generator is in thais arena",
"Dont forget to tell your friends about us",
"Use our referral system on the website for free donator points! www.zytheria.com",
}
broadcastmessage(MENSAGEM[math.random(1,#MENSAGEM)],19)
end
return TRUE
end
 
Try tu use this:
Code:
local t, i = {"Dont forget to donate!", "If you want to buy addons use, !addon", "Random Dungeon generator is in thais arena", "Dont forget to tell your friends about us", "Use our referral system on the website for free donator points! www.zytheria.com"}, 1

function onThink(interval)
    addEvent(Game.broadcastMessage, 150, t[i], MESSAGE_STATUS_WARNING)
    i = i == #t and 1 or i + 1
    return true
end
 
Try tu use this:
Code:
local t, i = {"Dont forget to donate!", "If you want to buy addons use, !addon", "Random Dungeon generator is in thais arena", "Dont forget to tell your friends about us", "Use our referral system on the website for free donator points! www.zytheria.com"}, 1

function onThink(interval)
    addEvent(Game.broadcastMessage, 150, t[i], MESSAGE_STATUS_WARNING)
    i = i == #t and 1 or i + 1
    return true
end
thank you will try it now
 
@margoh - It works good thanks
8paqwlt.png
 
Try to use this:
Code:
local t, i = {"Test!", "Second Test!", "Third Test!"}, 1

function onThink(interval)
    Game.broadcastMessage(t[i], MESSAGE_STATUS_WARNING)
    i = i == #t and 1 or i + 1
    return true
end
 
What errors you got?
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/broad.lua:onThink
data/globalevents/scripts/broad.lua:4: attempt to call field 'broadcastMessage' (a nil value)
stack traceback:
        [C]: in function 'broadcastMessage'
        data/globalevents/scripts/broad.lua:4: in function <data/globalevents/scripts/broad.lua:3>
[Error - GlobalEvents::think] Failed to execute event: say
 
Try to add to global.lua file this:
Code:
function Game.broadcastMessage(message, messageType)
    if messageType == nil then
        messageType = MESSAGE_STATUS_WARNING
    end

    local players = Game.getPlayers()
    for i = 1, #players do
        players[i]:sendTextMessage(messageType, message)
    end
end
 
Try to add to global.lua file this:
Code:
function Game.broadcastMessage(message, messageType)
    if messageType == nil then
        messageType = MESSAGE_STATUS_WARNING
    end

    local players = Game.getPlayers()
    for i = 1, #players do
        players[i]:sendTextMessage(messageType, message)
    end
end
now it works ty
 
Back
Top