Jump to content

i got a problem


Machine

Recommended Posts

Posted
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

Posted
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 ) 
  

  

Posted

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 ) 
  

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Timers aren't efficient, worst if used server side, I highly recommend you to use getTickCount instead.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
works

pls delete this topic

No need to remove the topic, someone else could have the same or similar problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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