Jump to content

help with command


Chaos

Recommended Posts

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)   
  
  
  
  
  

Link to comment

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 

Link to comment

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)  

Link to comment
  manawydan said:
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

Link to comment
  EstrategiaGTA said:
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

Link to comment

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) 

Link to comment
  manawydan said:
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...