Jump to content

Marker


Recommended Posts

yes it is possible getTickCount maybe will work for you?

example:

local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
            setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
            IntervalTeleport = getTickCount()
         else
            outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
         end
      end
    end
)

 

Edited by Burak5312
Link to comment
  • 2 months later...
On 08/08/2021 at 08:18, Burak5312 said:

yes it is possible getTickCount maybe will work for you?

example:

local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
            setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
            IntervalTeleport = getTickCount()
         else
            outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
         end
      end
    end
)

 

Thanks,but how can I do that may be after 5 guys hit the marker it will be closed like this?(not 1 like now)

Link to comment
marker = createMarker(arguments)
setElementData(marker, "playerhit", 5)

function markerData()
	getplayerhit = getElementData(marker, "playerhit")
	if getplayerhit >= 1 then
		setElementPosition( arguments )
		setElementData(marker, "playerhit" getplayerhit-1)
	elseif getplayerhit == 0 then
		outputChatBox("You need to wait some time to enter this", thePlayer, 255, 0, 0)
	end
end
addEventHandler("onMarkerHit", marker, markerData)

--make a timer function that sets the element data of the marker back to 5 for "playerhit".  

yes you will get errors if you straight up use this code read through it and add your arguments to what you want

 

use setTimer for the timer function.

Edited by kewizzle
Link to comment
On 12/10/2021 at 07:37, RandomRambo said:

Thanks,but how can I do that may be after 5 guys hit the marker it will be closed like this?(not 1 like now)

local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local hitsCount = 0
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(hitsCount < 5) then
            setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
            hitsCount = hitsCount + 1
         else
            if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
               setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
               IntervalTeleport = getTickCount()
            else
               outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
            end
         end
      end
    end
)

 

you can try this

  • Like 1
Link to comment
7 hours ago, Burak5312 said:
local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local hitsCount = 0
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(hitsCount < 5) then
            setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
            hitsCount = hitsCount + 1
         else
            if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
               setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
               IntervalTeleport = getTickCount()
            else
               outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
            end
         end
      end
    end
)

 

you can try this

Thanks,I'll try!

  • Like 1
Link to comment
On 13/10/2021 at 15:30, Burak5312 said:
local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local hitsCount = 0
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(hitsCount < 5) then
            setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
            hitsCount = hitsCount + 1
         else
            if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
               setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914)
               IntervalTeleport = getTickCount()
            else
               outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
            end
         end
      end
    end
)

 

you can try this

Doesn't work ?
It lets people to hit marker unlimited times anyway ?

Link to comment
4 minutes ago, RandomRambo said:

ye I put 30 mins delay

And when i hit 5 times marker,on the sixth try it let me hit it again

 

ok my mistake try this code

local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local hitsCount = 0
local teleportX, teleportY, teleportZ = 106.99030, 1924.18860, 18.52914
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(hitsCount < 5) then
            setElementPosition(hitElement, teleportX, teleportY, teleportZ)
            hitsCount = hitsCount + 1
            if(hitsCount == 5) then
              IntervalTeleport = getTickCount()
            end
         else
            if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
               setElementPosition(hitElement, teleportX, teleportY, teleportZ)
               IntervalTeleport = getTickCount()
            else
               outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
            end
         end
      end
    end
)

 

  • Thanks 1
Link to comment
8 minutes ago, Burak5312 said:

 

ok my mistake try this code

local DELAY_TELEPORT = 5000 -- millisecond delay
local IntervalTeleport = 0
local hitsCount = 0
local teleportX, teleportY, teleportZ = 106.99030, 1924.18860, 18.52914
local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255)

addEventHandler("onMarkerHit", teleportMarker,
    function(hitElement)
      if(getElementType(hitElement) == "player") then
         if(hitsCount < 5) then
            setElementPosition(hitElement, teleportX, teleportY, teleportZ)
            hitsCount = hitsCount + 1
            if(hitsCount == 5) then
              IntervalTeleport = getTickCount()
            end
         else
            if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second
               setElementPosition(hitElement, teleportX, teleportY, teleportZ)
               IntervalTeleport = getTickCount()
            else
               outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false)
            end
         end
      end
    end
)

 

Now it works perfectly!Thanks a lot :)

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