What's new

[8.54]Rozbudowany broadcast

Status
Not open for further replies.

zygzagZ

Advanced User
Joined
Aug 14, 2008
Messages
281
Reaction score
34
Witam. Jako, ?e mi by?o potrzebne, to rozbudowa?em skrypt na broadcast. Mo?e wam si? przyda.
Mo?na u?ywa? np. do pisania og?osze? co kilka minut.
Zamiast , (przecinka) jest u?ywane | !
Zastosowanie:
Code:
/b <tre??>|<czy ukry? nick>|<ile razy ma broadcast>|<co ile sekund ma broadcast>
Dzia?a te?:
/b <tre??>|<czy ukry? nick>
oraz samo
/b <tre??>
je?li kto? zapomni to  wystarczy wpisa? /b i si? wy?wietli pomoc
Skrypt:
w talkcations/scripts/broadcast.lua (istnieje, wi?c kasujemy zawarto?? i wklejamy kod ni?ej)
Code:
function onSay(cid, words, param)
        local t = string.explode(param, "|")
        if (t[1] and t[2] and t[3] and t[4]) then
           if t[2] == 'yes' then
               for i = 0, (t[3] - 1) do
                 addEvent(doBroadcastMessage, i * t[4] * 1000, t[1])
               end
           elseif t[2] == 'no' then
               for i = 0, (t[3] - 1) do
                 addEvent(doPlayerBroadcastMessage, i * t[4] * 1000,cid, t[1])
               end
           else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Uzyj /b <tekst>|<czy ukryc nick yes/no>|<ile razy>|<co ile>")          
           end
        elseif (t[1] and t[2] and t[3]) then
	            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wpisz co ile ma byc broadcast.")
        elseif (t[1] and t[2]) then
               if t[2] == 'yes' then
                  doBroadcastMessage(t[1])
               elseif t[2] == 'no' then
                  doPlayerBroadcastMessage(cid,t[1])
               end
        elseif (t[1]) then
               doPlayerBroadcastMessage(cid,param)
        else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Uzyj /b <tekst>|<czy ukryc nick yes/no>|<ile razy>|<co ile>")
        end
           return TRUE
end
Pozdro. PS. m?j pierwszy skrypt z p?tlami :]
zygzagZ.
Edt.
Code:
10:00 GoD[1]:/b test|yes|3|120 
10:00 test
10:02 test
10:04 test
10:10 GoD[1]:/b test|no|3|180
10:10 GoD[1]: test
10:13 GoD[1]: test
10:16 GoD[1]: test
 
Status
Not open for further replies.
Top