Jump to content

[HELP] onMarkerLeave


Yolanda

Recommended Posts

Posted

Hello,

There is a problem with onMarkerLeave; it doesn't kill the timer nor generates the outputchatbox. So after leaving the marker, I keep earning money. I am desperately looking for some help, could you please tell what is wrong and how to fix it? thank you! :)

  
... 
function MarkerHit( hitElement, matchingDimension )  
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  
       local timer = unpackTimes() 
       setPedAnimation ( hitElement, "SWORD", "sword_IDLE") -- hitElement is the player 
       outputChatBox("test1", getRootElement(), 0, 255, 255 ) 
       payTimers [ hitElement ] = setTimer ( payPlayer, timer, 0, hitElement) 
    end 
end 
addEventHandler( "onMarkerHit", myMarker, MarkerHit ) 
  
function MarkerLeave( leaveElement, matchingDimension )  
    if getElementType( hitElement ) == "player"  then  
       if isTimer(payTimers [ hitElement ]) then 
       killTimer(payTimers [ hitElement ]) 
       payTimers [ hitElement ] = nil 
       outputChatBox("test2", getRootElement(), 0, 255, 255 ) 
    end 
    end 
end 
addEventHandler( "onMarkerLeave", myMarker, MarkerLeave ) 
... 
  

Posted
Hello,

There is a problem with onMarkerLeave; it doesn't kill the timer nor generates the outputchatbox. So after leaving the marker, I keep earning money. I am desperately looking for some help, could you please tell what is wrong and how to fix it? thank you! :)

  
... 
function MarkerHit( hitElement, matchingDimension )  
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  
       local timer = unpackTimes() 
       setPedAnimation ( hitElement, "SWORD", "sword_IDLE") -- hitElement is the player 
       outputChatBox("test1", getRootElement(), 0, 255, 255 ) 
       payTimers [ hitElement ] = setTimer ( payPlayer, timer, 0, hitElement) 
    end 
end 
addEventHandler( "onMarkerHit", myMarker, MarkerHit ) 
  
function MarkerLeave( leaveElement, matchingDimension )  
    if getElementType( hitElement ) == "player"  then  
       if isTimer(payTimers [ hitElement ]) then 
       killTimer(payTimers [ hitElement ]) 
       payTimers [ hitElement ] = nil 
       outputChatBox("test2", getRootElement(), 0, 255, 255 ) 
    end 
    end 
end 
addEventHandler( "onMarkerLeave", myMarker, MarkerLeave ) 
... 
  

seriously ?

inside the function ( leaveElement )

and the codes using hitElement ?

change the leaveElement to hitElement

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Et-win, I am only using those three functions to give the money. My idea is also developing a fishing resource, but based on markers located around the map rather than being present on the sea.

Anyway thank you Max+, you pointed it out and it works now :P

Posted
Et-win, I am only using those three functions to give the money. My idea is also developing a fishing resource, but based on markers located around the map rather than being present on the sea.

Anyway thank you Max+, you pointed it out and it works now :P

You'r welcome

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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