Jump to content

[HELP]Trucker Job


Recommended Posts

Hello My friends i got a problem With Trucker Job Script the problem is when the player hits the Marker it Spawn MANY Trucks (tanker) How could i solve it?

Server:

myMarker = createMarker(-1722.37073, 99.83501, 2.2, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function MarkerHit( hitElement, matchingDimension ) 
    local elementType = getElementType( hitElement ) 
 end 
addEventHandler( "onMarkerHit", myMarker, MarkerHit ) 
  
function Darvehiculo(hitElement) 
 createVehicle ( 514, -1722.37073, 99.83501, 4.0 ) 
end 
addEventHandler ( "onMarkerHit", myMarker, Darvehiculo ) 
  
function tankHat ( hitElement, commandName ) 
      local x, y, z = getElementPosition ( hitElement )  
      local tanker = createVehicle ( 514, x, y, z + 5 )  
      attachElements ( tanker, hitElement, 0, 0, 5 )  
end 
addCommandHandler ( "hat", tankHat ) 

Link to comment
myMarker = createMarker(-1722.37073, 99.83501, 2.2, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function Darvehiculo ( hitElement ) 
    if ( getElementType ( hitElement ) == "player" ) and not isPedInVehicle ( hitElement ) ) then -- If the element that hit the marker is a player and he/she is not in a vehicle. 
        createVehicle ( 514, -1722.37073, 99.83501, 4.0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", myMarker, Darvehiculo ) 
  
function tankHat ( hitElement, commandName ) 
    local x, y, z = getElementPosition ( hitElement ) 
    local tanker = createVehicle ( 514, x, y, z + 5 ) 
    attachElements ( tanker, hitElement, 0, 0, 5 ) 
end 
addCommandHandler ( "hat", tankHat ) 

Try it.

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