• 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!

TalkAction Auto-Broadcast, Without NPC [Request]

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,707
Reaction score
32
I Recently Added some payments system and i would like to advertise my websites on my servers, Could i add like an Auto-Broadcaster every 30 Mins?

It should say like: Visit our Website and donate now for special features! WarOT - Home Page
 
You can use something like this:

Go to globalevents/scripts.. and create a file called autobroadcast.lua and add:

Code:
function onThink(interval, lastExecution)
local message = "Visit our Website and donate now for special features! WarOT - Home Page"

doBroadcastMessage("Information: " .. message .. "", MESSAGE_STATUS_CONSOLE_ORANGE)
return TRUE
end

or.. if you want to broadcast more messages then:

Code:
local messages = {
	"Visit our Website and donate now for special features! WarOT - Home Page",
	"Visit our forum."
}

local i = 0
function onThink(interval, lastExecution)
local message = messages[(i % #messages) + 1]
    doBroadcastMessage("Information: " .. message .. "", MESSAGE_STATUS_CONSOLE_ORANGE)
    i = i + 1
    return TRUE
end

and add this in globalevents.xml

Code:
	<globalevent name="information" interval="1800" event="script" value="autobroadcast.lua"/>

(1800 = 30 minutes (1800 seconds))
 
I Dont have the file globalevents :/, im using Tfs 0.2 Distro
 
why not use npc? works exactly the same way as global events

Allright i'll use an npc, could u post the correct script? Your "Roxor server" npc's we're fucking up so i can't use them, i gotta find working npc's, would appreciate it if you fixxed one for me :p and posted the script here or private :wub:
 
Maybe adding something like that (I don't know if this works)

Code:
function npcBroadcast()
doBroadcastMessage("Hello")
addEvent(npcBroadcast, (30*60))
end

The use it something like this:
Code:
if msgcontains(msg, 'broadcast') then
npcBroadcast()
end
 
Try it:

global.lua
PHP:
broadcastDelay = 30 * 60 * 1000 -- in miliseconds  
storageValue = 700800  
if (getGlobalStorageValue(storageValue) == LUA_ERROR) then  
    function save(broadcastDelay)  
		doBroadcastMessage("Hello")
        print(">>>>..::MESSAGE BROADCASTED::..<<<<")  
        addEvent(save, broadcastDelay, broadcastDelay)  
    end  
    addEvent(save, broadcastDelay, broadcastDelay)  
    setGlobalStorageValue(storageValue, TRUE)  
end
Based on Colandus's save system.
 
Back
Top