Chaos Posted September 16, 2013 Posted September 16, 2013 hi, i need when someone do /checkMoney then all players should have to wait 30 secs to use the command again function checkMoney(thePlayer, command) local money = getPlayerMoney(thePlayer) outputChatBox(getPlayerName (thePlayer).. "has got :" .. tostring(money), root,0,255,0) end addCommandHandler("checkMoney", checkMoney)
Chaz-CR Posted September 16, 2013 Posted September 16, 2013 Im not sure how to do that, but here is a public resource that can be useful for you! https://community.multitheftauto.com/ind ... ls&id=4075
Chaos Posted September 16, 2013 Author Posted September 16, 2013 i don't want to kick the player and i want all players should waiting 30 secs if the command activated
Chaz-CR Posted September 16, 2013 Posted September 16, 2013 so you could try whit this! https://community.multitheftauto.com/ind ... ls&id=3284
Chaz-CR Posted September 16, 2013 Posted September 16, 2013 I saw this script by @Alexs_Steel local commandSpam = {} function preventCommandSpam() if (not commandSpam[source]) then commandSpam[source] = 1 -- New person so add to table elseif (commandSpam[source] == 5) then cancelEvent() outputChatBox("Please refrain from command spamming!", source, 255, 0, 0) -- This person is command spamming! else commandSpam[source] = commandSpam[source] + 1 -- Add one to the table end end addEventHandler("onPlayerCommand", root, preventCommandSpam) setTimer(function() commandSpam = {} end, 1000, 0) -- Clear the table every second
Chaz-CR Posted September 16, 2013 Posted September 16, 2013 Just add the command in this table I saw this script by @Alexs_Steel local commandSpam = {}
EstrategiaGTA Posted September 16, 2013 Posted September 16, 2013 (edited) Actually it is not hard, just use removeCommandHandler setTimer So when you use the command, it removes the command and in X seconds you set it back. Edited September 16, 2013 by Guest
manawydan Posted September 16, 2013 Posted September 16, 2013 probar local TableComand = {} local TableTimer = {} function checkMoney(thePlayer, command) if (TableComand[thePlayer] == false ) or not TableComand[thePlayer] then local money = getPlayerMoney(thePlayer) outputChatBox(getPlayerName (thePlayer).. "has got :" .. tostring(money), root,0,255,0) TableComand[thePlayer] = true TableTimer[thePlayer] = setTimer(function() TableComand[thePlayer] = false end,30000,1) end end addCommandHandler("checkMoney", checkMoney)
EstrategiaGTA Posted September 16, 2013 Posted September 16, 2013 Still, I've other idea: why don't you just make the outputChatBox only for the player, not to all? You do this because of spamming, but, if you do it for him only, he will just spam himself.
Chaos Posted September 16, 2013 Author Posted September 16, 2013 probar local TableComand = {} local TableTimer = {} function checkMoney(thePlayer, command) if (TableComand[thePlayer] == false ) or not TableComand[thePlayer] then local money = getPlayerMoney(thePlayer) outputChatBox(getPlayerName (thePlayer).. "has got :" .. tostring(money), root,0,255,0) TableComand[thePlayer] = true TableTimer[thePlayer] = setTimer(function() TableComand[thePlayer] = false end,30000,1) end end addCommandHandler("checkMoney", checkMoney) Chaoshas got :108213 [uST]XxJaviNpxX: dime Chaos: type /checkMoney Chaos: type /checkMoney Chaos: type /checkMoney rulocardenas: oye espera a que se junten muchos [uST]XxJaviNpxXhas got :406 [uST]XxJaviNpxX: ya [uST]XxJaviNpxX: pero quiero un arma o algo look here when i did /checkMoney the timer only works for me but when the other type /checkMoney the timer won't works for him i don't want the time only for the player who did it i need to all should wait example when i type /checkmoney then all must wait 30 secs not only me and not only who did the command
Chaos Posted September 16, 2013 Author Posted September 16, 2013 Still, I've other idea: why don't you just make the outputChatBox only for the player, not to all? You do this because of spamming, but, if you do it for him only, he will just spam himself. that's just an example the chatbox it is not my problem
manawydan Posted September 16, 2013 Posted September 16, 2013 try, no tested XatD = true function checkMoney(thePlayer, command) if (XatD == true) then local money = getPlayerMoney(thePlayer) outputChatBox(getPlayerName (thePlayer).. "has got :" .. tostring(money), root,0,255,0) XatD = false setTimer(function() XatD = true end,30000,1) end end addCommandHandler("checkMoney", checkMoney)
Chaos Posted September 17, 2013 Author Posted September 17, 2013 try, no tested XatD = true function checkMoney(thePlayer, command) if (XatD == true) then local money = getPlayerMoney(thePlayer) outputChatBox(getPlayerName (thePlayer).. "has got :" .. tostring(money), root,0,255,0) XatD = false setTimer(function() XatD = true end,30000,1) end end addCommandHandler("checkMoney", checkMoney) works perfect thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now