Jump to content

Timer


TorNix~|nR

Recommended Posts

Hello guys, I want to make a timer for this

like the player can not use it, only after 30 seconds, help please!

marker = createMarker(1.00, 1.00, 1.00, "cylinder", 0, 0, 0, 0, 0)

function teleport(player)
local x, y, z = getElementPosition(player)
local rotZ = getElementRotation ( player )
local aa = {}
        if (source == marker and getElementType(player) == "player") then
        setElementPosition(player, 1.00, 1.00, 1.00)
        setElementFrozen(player, false)
        setTimer(setElementFrozen, 1000, 1, player, false) 	
     end
end   
addEventHandler("onMarkerHit", root, teleport)

 

Link to comment

htt

9 hours ago, TorNix~|nR said:

Hello guys, I want to make a timer for this

like the player can not use it, only after 30 seconds, help please!


marker = createMarker(1.00, 1.00, 1.00, "cylinder", 0, 0, 0, 0, 0)

function teleport(player)
local x, y, z = getElementPosition(player)
local rotZ = getElementRotation ( player )
local aa = {}
        if (source == marker and getElementType(player) == "player") then
        setElementPosition(player, 1.00, 1.00, 1.00)
        setElementFrozen(player, false)
        setTimer(setElementFrozen, 1000, 1, player, false) 	
     end
end   
addEventHandler("onMarkerHit", root, teleport)

 

marker = createMarker(1.00, 1.00, 1.00, "cylinder", 0, 0, 0, 0, 0)

time = 0

function teleport(player)
local x, y, z = getElementPosition(player)
local rotZ = getElementRotation ( player )
local aa = {}
	if getTickCount() - time >= 30000 then -- 30 seg
        if (source == marker and getElementType(player) == "player") then
			setElementPosition(player, 1.00, 1.00, 1.00)
			setElementFrozen(player, false)
			setTimer(setElementFrozen, 1000, 1, player, false) 	
			time = getTickCount()
		end
	else
		outputChatBox("You must wait 30 seconds to use this.", player, 255, 0, 0)
    end
end   
addEventHandler("onMarkerHit", root, teleport)

 

  • Haha 1
Link to comment

Store the timer in a table for each player for example

Table[player]= Timer(function ()end,3000,1)

And to check you simply do

if isTimer(Table[player]) then

Output you deny message

else

Let them in

end

Edited by Mr.Loki
I'm on mobile sorry ?
  • Thanks 1
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...