Jump to content

Add command restriction time "60" secs


novo

Recommended Posts

  
                        if not getElementData ( player, "commandTimer" ) then 
                setElementData ( player, "commandTimer", true ) 
                setTimer ( setElementData, 60000, 1, player, "commandTimer", false ) 
            else 
                outputChatBox ( "You need to wait 60 seconds until executing the command again!", 125, 0, 0 ) 
            end 
  

Link to comment

I want add the timer to those commands;

-------------------------- 
--    PUSH CMD start    -- 
-------------------------- 
function pushHisFreakingAss (playerSource, command, arg1) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if (arg1 == nil ) or ( arg1 == false ) then 
            outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
        else 
            if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
                local playerElement = getPlayerFromName(arg1) 
                if playerElement then 
                  local name = getPlayerName(playerElement) 
                     local sourceName = getPlayerName(playerElement) 
                     local theVehicle = getPedOccupiedVehicle(playerElement) 
                    local hisCar = getPedOccupiedVehicle(playerElement) 
                    local x, y, z = getElementVelocity ( hisCar ) 
                    setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
                end 
            end     
        end 
    end 
end 
addCommandHandler("push", pushHisFreakingAss) 
-------------------------- 
--    PUSH CMD end  -- 
-------------------------- 
  
-------------------------- 
--    FIX CMD start -- 
-------------------------- 
  
function fixx ( playerSource, command ) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
            outputChatBox ("#0082D8" .. getPlayerName(playerSource) .." fixes his self !", getRootElement(), 255, 255, 255, true) 
          if isPedInVehicle(playerSource) then 
                local vehicle = getPedOccupiedVehicle(playerSource) 
               fixVehicle(vehicle) 
            end 
        end 
    end 
end 
addCommandHandler ( "fix", fixx ) 
  
-------------------------- 
--    FIX CMD end   -- 
-------------------------- 
  
-------------------------- 
--    NOS CMD start -- 
-------------------------- 
  
function nitro1 ( playerSource, command ) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
           outputChatBox ("#0082D8" .. getPlayerName(playerSource) .." gives nos to his self !", getRootElement(), 255, 255, 255, true) 
          if isPedInVehicle(playerSource) then 
                local vehicle = getPedOccupiedVehicle(playerSource) 
               addVehicleUpgrade(vehicle,1010) 
            end 
        end 
    end 
end 
addCommandHandler ( "nos", nitro1 ) 
  
-------------------------- 
--    NOS CMD end   -- 
-------------------------- 
  
-------------------------- 
--    FLIP CMD start   -- 
-------------------------- 
  
function flip () 
end 
  
-------------------------- 
--    FLIP CMD end   -- 
-------------------------- 

Where to add it ?

Link to comment
  
    function pushHisFreakingAss (playerSource, command, arg1) 
        local account = getPlayerAccount( playerSource ) 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
        else 
            if (arg1 == nil ) or ( arg1 == false ) then 
                outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
            else 
                  
                if not getElementData ( player, "commandTimer" ) then 
                    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
                        local playerElement = getPlayerFromName(arg1) 
                        if playerElement then 
                        local name = getPlayerName(playerElement) 
                            local sourceName = getPlayerName(playerElement) 
                            local theVehicle = getPedOccupiedVehicle(playerElement) 
                            local hisCar = getPedOccupiedVehicle(playerElement) 
                            local x, y, z = getElementVelocity ( hisCar ) 
                            setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                            outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
                        end 
                    end  
                    setElementData ( player, "commandTimer", true ) 
                    setTimer ( setElementData, 60000, 1, player, "commandTimer", false ) 
                else 
                    outputChatBox ( "You need to wait 60 seconds until executing the command again!", 125, 0, 0 ) 
                end 
            end 
        end 
    end 
    addCommandHandler("push", pushHisFreakingAss) 

This should be the first function. Now understand this and put it in your codes ;)

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...