Jump to content

set timer and acl


~Sr.Victor

Recommended Posts

I don't know how to do it, I wanted to put a time of 10 seconds to type the command again and also the command can only be given with the ACL

 

function progressodeagle(thePlayer)
    if isElementWithinMarker(thePlayer, deagle2) then
    	local currentMoney = getPlayerMoney(thePlayer)
    
        if currentMoney >= 2500 then
            takePlayerMoney(thePlayer, 2500) 
            giveWeapon(thePlayer, 24, 2)
            setPedFrozen(thePlayer, true)
            setPedAnimation(thePlayer, "ped", "bomber", 16000, true, false, false, false)
            setTimer(setPedFrozen, 16000, 1, thePlayer, false)
            setTimer(giveWeapon,16000, 1, thePlayer, 24, 450)
        else
            exports.hy_info:showBoxS(thePlayer, "#00FFFFVocê não possui dinheiro para fabricar esta arma!", "error")
        end
    end
end
addCommandHandler("fabricar", progressodeagle)

 

Link to comment
  • Moderators
On 03/08/2020 at 02:45, ~Sr.Victor said:

I wanted to put a time of 10 seconds to type the command again

local nextCommandTime = {}


-- function ()

local key = getPlayerSerial(player) -- serial based
-- or
local key = player -- element based

local timeNow = getTickCount()

if timeNow > (nextCommandTime[key] or 0) then
  
	nextCommandTime[key] = timeNow + 10000
else
  -- You will have to wait!
end

-- end

By comparing current operating time with a fixed operating time + future offset, can be used to limit executions.

 

ACL

Manually:

- Shut down the server (important)

Disable commands in ACL: (add to the group: <acl name="Default">)

<right name="command.fabricar" access="false" />

Enable commands in ACL: (add to the group you want to have access to this command)

<right name="command.fabricar" access="true" />

- Save file

- Start the server

 

Or use admin panel to add those rights.

 

 

@~Sr.Victor

 

 

 

 

 

Edited by IIYAMA
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...