Jump to content

Question


manve1

Recommended Posts

How can i make a script to get a specific vehicle that was created?

EDIT:

Like if i made a vehicle using this function:

local monsterNot = createVehicle( 411, 0, 0, 1 ) 

How can i make like that some other function would work only for this vehicle, for example: if i was going to do a marker hit, it would work only for this vehicle, not the rest not even with same id.

Link to comment

I got this part, but i can't figure out how to.

EDIT:

my script looks like this:

addEventHandler('onMarkerHit', marker1, 
function( thePlayer ) 
    if ( getPedOccupiedVehicle( thePlayer ) == theTrashCar ) then 
    triggerClientEvent('marker1_', thePlayer) 
    end 
end 
) 

well, i got the car made .. but i can't figure out why it doesn't get the car :cry:

Link to comment

SERVER:

  
local marker1 = createMarker( 2316.25, -1933, 12, 'cylinder', 3.0, 155, 155, 0, 155 ) 
  
theTrashCar = createVehicle( 408, 2201, -1978, 17, 0, 0, 270 ) 
  
addEventHandler('onMarkerHit', marker1, 
function( thePlayer ) 
    if ( getPedOccupiedVehicle( thePlayer ) == theTrashCar ) then 
    triggerClientEvent('marker1_', thePlayer) 
    end 
end 
) 
  

CLIENT:

  
addEvent('marker1_', true) 
addEventHandler('marker1_', getRootElement(), 
function() 
owner = getPedOccupiedVehicle( localPlayer ) 
setElementFrozen( localPlayer, true ) 
setElementFrozen( owner, true ) 
end 
) 
  

Link to comment
local marker1 = createMarker ( 2316.25, -1933, 12, 'cylinder', 3.0, 155, 155, 0, 155 ) 
theTrashCar = createVehicle ( 408, 2201, -1978, 17, 0, 0, 270 ) 
  
addEventHandler ( 'onMarkerHit', marker1, 
    function ( thePlayer ) 
        if ( getElementType ( thePlayer ) == "player" and getPedOccupiedVehicle ( thePlayer ) == theTrashCar ) then 
            outputChatBox ( "Vehicle match" ) 
            triggerClientEvent ( thePlayer, 'marker1_', thePlayer ) 
        end 
    end 
) 

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