Jump to content

pickup Timer


OrbTanT

Recommended Posts

How put a time in pickup, for when the player is at the up of the pickup, every 30 seconds he of the collect for the player. I tried to add the time more I had no result.

    pickup1 = createPickup ( 2511.323, -1688.844, 13.549, 1, 15, 0 ) 
  
addEventHandler("onPickupHit", pickup1,  
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(GROVE)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 

Link to comment

Is this what do you mean?

local timer = {} 
local pickup1 = createPickup( 2511.323, -1688.844, 13.549, 1, 15, 0 ) 
  
addEventHandler( "onPickupHit", pickup1, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        if isTimer(timer[player]) then return end 
         
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(GROVE)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
        timer[player] = setTimer(function() end, 30000, 1) 
    else 
        outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
  
addEventHandler( "onPlayerQuit", root, 
    function() 
        if timer[source] then 
            timer[source] = nil 
        end 
    end 
) 
  

I really can't understand his english.

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