TalkAction Broadcast script

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
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:
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
Had a small problem, but script should be working now again.
 

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,766
Best answers
0
Reaction score
35
Wow nice script why dont u add an times to it to broadcast every xx time??


Off-Topic

YEY FIRST PERSON WITH 800 POSTS!
 
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
Explain a bit further what you mean.

Didn't quite understand what you meant.
 

michael

New Member
Joined
Jun 2, 2007
Messages
122
Best answers
0
Reaction score
0
Location
Netherlands
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
 
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
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:

michael

New Member
Joined
Jun 2, 2007
Messages
122
Best answers
0
Reaction score
0
Location
Netherlands
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:
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
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?
 

Jiraiya

New Member
Joined
Aug 6, 2007
Messages
127
Best answers
0
Reaction score
0
rox... But is there a way to make spells animate? without source?
 
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
And when I say "give REP!" I mean pushing on the reputation button too ;)
(The button at my post below where it says "Reputation:
")

I wanna get it like this: Reputation:
:D
 

Saphira

New Member
Joined
Oct 2, 2007
Messages
69
Best answers
0
Reaction score
0
really nice... been looking for this many times...
Thanks mate! :)

//Saphira
 

fokuleh

New Member
Joined
Oct 25, 2007
Messages
156
Best answers
0
Reaction score
0
it don't work for me, only when i try to use it don't do anything
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,873
Best answers
60
Reaction score
389
Location
Germany
For me it don't make nothink. I have 0.2.6
 
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
You've gotta have done something wrong. Sure you got the right group_id?
 
OP
J

Jonern

Retired
Joined
May 31, 2007
Messages
1,054
Best answers
0
Reaction score
8
Location
Norway
That's why. The script is made to use/accept group_id 2 or 3. (Standard for TFS)
 
Top