• 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 Broadcast script

Jonern

Retired
Senator
Joined
May 31, 2007
Messages
1,054
Reaction score
8
Location
Norway
I've made a small broadcast script if anyone wants it ;)
Remember, since the broadcastMessage() function has changed, it will probably not work with older versions.
Not sure with 0.2.5, but guaranteed under 0.2.6 (You must compile it yourself, still under development)
(Don't forget to give REP if you use it! :))

/data/talkactions/scripts/broadcast.lua:
Code:
-- Broadcast script by Jonern

function onSay(cid, words, param)
    if getPlayerGroupId(cid) == 2 or getPlayerGroupId(cid) == 3 and param ~= nil then
        local textColor = MESSAGE_EVENT_ADVANCE
        local setColor = FALSE
        if string.find(param," ",string.find(param,"[red,white,white2,orange,green,small,blue,red2]")+1) ~= nil then            
            color = string.sub(param,0,string.find(param," ")-1)
            if color == "red" then
                textColor = MESSAGE_STATUS_WARNING
                setColor = TRUE
            elseif color == "white" then
                textColor = MESSAGE_EVENT_ADVANCE
                setColor = TRUE
            elseif color == "white2" then
                textColor = MESSAGE_EVENT_DEFAULT
                setColor = TRUE
            elseif color == "orange" then
                textColor = 17
                setColor = TRUE
            elseif color == "green" then
                textColor = MESSAGE_INFO_DESCR
                setColor = TRUE
            elseif color == "small" then
                textColor = MESSAGE_STATUS_SMALL
                setColor = TRUE
            elseif color == "blue" then
                textColor = MESSAGE_STATUS_CONSOLE_BLUE
                setColor = TRUE
            elseif color == "red2" then
                textColor = MESSAGE_STATUS_CONSOLE_RED
                setColor = TRUE
            end
        end
        if setColor == TRUE then
            broadcastMessage(string.sub(param,string.find(param," ")+1,string.len(param)),textColor)
        else
            broadcastMessage(param,textColor)
        end
    end
end
And add this in /data/talkactions/talkaction.xml:
Code:
<talkaction words="!bc" script="broadcast.lua"/>
Example of use:
!bc "red Hello! --> will print "Hello!" without your name first. (/B Hello! --> Jonern: Hello!)
Also, if you don't set any colors, it will print in white.

Don't forget to give REP(!) if you use it :) (THE REP BUTTON!)
 
Last edited:
Wow nice script why dont u add an times to it to broadcast every xx time??


Off-Topic

YEY FIRST PERSON WITH 800 POSTS!
 
Explain a bit further what you mean.

Didn't quite understand what you meant.
 
If i use your script and i to !bc "red blablabla I only get the number of the color and not the message. Tested under tfs 0.2.4
 
Yeah, it's because the broadcastMessage() function has changed from then.
I think it actually only works under 0.2.6 which you must compile yourself.

I'll update my first post.

And again, don't forget to give REP if you will use it!
 
Last edited:
Yeah, it's because the broadcastMessage() function has changed from then.
I think it actually only works under 0.2.6 which you must compile yourself.

I'll update my first post.

And again, don't forget to give REP if you will use it!

I use 0.2.4 witch is below 0.2.6
 
Last edited:
I use 0.2.4 witch is below 0.2.6
When I write "under 0.2.6" I mean "under" as "on this platform" and not all versions that is below 0.2.6.

So, it will only work on 0.2.6 and newer, but again, still not sure about 0.2.5.
Has anyone tested this script for 0.2.5?
 
And when I say "give REP!" I mean pushing on the reputation button too ;)
(The button at my post below where it says "Reputation:
reputation_pos.gif
")

I wanna get it like this: Reputation:
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
reputation_pos.gif
:D
 
That's why. The script is made to use/accept group_id 2 or 3. (Standard for TFS)
 
Back
Top