Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2015-02-28, 10:41


Mateusz512







Wiek: 27
Na forum: 4652 dni
Posty: 44



Respekt: 50

Witam, mam tutaj sw?j skrawek kodu kt?ry mi nie dzia?a, wpisuj? go na razie w freeroama i nic, gdy bindami spami? nic si? nie blokuje, prosi?bym o poprawk? kodu lub o jaki? lepszy kod.


addEventHandler("onPlayerChat",root,function ()
if getElementData(source,"blockspam") then
local sekundy = getElementData(source,"blockspam")
cancelEvent()
outputChatBox("Odczekaj "..sekundy.." zanim co? napiszesz.",source,255,255,255,true)
else
local player = source
setElementData(source,"blockspam",5)
setTimer(function () setElementData(player,"blockspam",4) end,1000,1)
setTimer(function () setElementData(player,"blockspam",3) end,2000,1)
setTimer(function () setElementData(player,"blockspam",2) end,3000,1)
setTimer(function () setElementData(player,"blockspam",1) end,4000,1)
setTimer(function () setElementData(player,"blockspam",nil) end,5000,1)
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-28, 10:43


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Freeroam posiada w?asny system chatu, wy??cz go.

poza tym :

setTimer(function () setElementData(player,"blockspam",nil) end,5000,1)


Nie nil a false jak cos.

Polecam lepsz? budow? :

setTimer ( setElementData, 5000, 1, player, "blockspam", false )


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-28, 10:48


Mateusz512







Wiek: 27
Na forum: 4652 dni
Posty: 44



Respekt: 50

Rozumiem ?e w freeroamie chodzi o 404 linijk? w fr_server.lua ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-28, 12:27


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

addEventHandler('onPlayerChat', g_Root,
    function(msg, type)
        if type == 0 then
            cancelEvent()
            if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then
                outputChatBox("Stop spamming main chat!", source, 255, 0, 0)
                return
            else
                chatTime[source] = getTickCount()
            end
            if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then
                outputChatBox("Stop repeating yourself!", source, 255, 0, 0)
                return
            else
                lastChatMessage[source] = msg
            end
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true)
            outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg )
        end
    end
)


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-28, 12:29


Mateusz512







Wiek: 27
Na forum: 4652 dni
Posty: 44



Respekt: 50

Usun??em to, wklei?em zamiast tego ten wcze?niejszy kod i nie dzia?a ;/

Postaw piwo autorowi tego posta
 

 
Tagi: spam
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Spam Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku