Machine Posted June 24, 2013 Posted June 24, 2013 myMarker = createMarker(2488.1000976563, -1667.5, 13.300000190735, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( killer, matchingDimension ) setTimer( givePlayerMoney, 1000, 0, hitElement, 10 ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) script must create marker and when player hit it he got 1000$ and i use timer to make him only can do it every 5 mins but something wrong in it
iPrestege Posted June 24, 2013 Posted June 24, 2013 myMarker = createMarker(2488.1000976563, -1667.5, 13.300000190735, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( killer, matchingDimension ) setTimer( givePlayerMoney, 1000, 0, hitElement, 10 ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) script must create marker and when player hit it he got 1000$ and i use timer to make him only can do it every 5 mins but something wrong in it Your code is wrong .. try this : -- # Server Side ... local myMarker = createMarker( 2488.1000976563, -1667.5, 13.300000190735, 'cylinder', 2.0, 255, 0, 0, 150) local aTimerFlood = { } function MarkerHit( hitElement, matchingDimension ) if getElementType ( hitElement ) == "player" then if isTimer ( aTimerFlood [ hitElement ] ) then return outputChatBox ("Please Wait a Minute!!!",hitElement,255,0,0) end givePlayerMoney ( hitElement,1000 ) aTimerFlood [ hitElement ] = setTimer ( function ( ) if isTimer ( aTimerFlood [ hitElement ] ) then killTimer ( aTimerFlood [ hitElement ] ) aTimerFlood [ hitElement ] = nil end end ,300000 , 1 ) end end addEventHandler( "onMarkerHit", myMarker, MarkerHit,false )
iMr.3a[Z]eF Posted June 24, 2013 Posted June 24, 2013 try: myMarker = createMarker(2488.1000976563, -1667.5, 13.300000190735, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( player ) if getElementType(player) == "player" then givePlayerMoney (1000, player) setTimer( destroyElement(myMarker) 30000, 1) end end addEventHandler( "onMarkerHit", myMarker, MarkerHit )
Castillo Posted June 24, 2013 Posted June 24, 2013 Timers aren't efficient, worst if used server side, I highly recommend you to use getTickCount instead.
Castillo Posted June 25, 2013 Posted June 25, 2013 workspls delete this topic No need to remove the topic, someone else could have the same or similar problem.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now