Jump to content

onVehicleMarkerHit


Zadara

Recommended Posts

Hi there,

I am busy with a little script, but i got one problem, i wanna use a marker to attach a vehicle to a vehicle, i wanna have a callback that is that the vehicle the source is, so i go search on MTA wiki if there is a callback function for: onVehicleMarkerHit, but there is'nt, only onMarkerHit, and OnPlayerMarkerhit. :( How i can script this so simple has possible?

function enterVehicle ( player, seat, jacked ) 
    if ( getVehicleID ( source ) == 476 ) then 
        outputChatBox ("You are enter a Ruslter!.") 
        local x, y, z = getElementPosition( source ) 
        local rcbaron = createVehicle ( 464, x, y, z - 2 ) 
        attachElementToElement( rcbaron, source, 0, 0, -2 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 

Thanks,

Link to comment
onMarkerHit. :D

It works with any element. Read the page. ;)

The problem is that by the onMarkerHit, the source the maker, but i don't want that the source the marker is, but that the source the vehicle is. How can i solv this?

you've got the player that hit the marker, just check if he's in a vehicle and that he is driving it

Link to comment

I'm not sure whether or not it's actually accurate, but according to its wiki page, onMarkerHit does NOT work with generic elements, only with players. I recommend that you create a collision shape (colshape) that you hook up to events, and keep the marker only for "decoration".

Link to comment

Thanks, one question: onVehicleRespawn, when a vehicle spawn just on the beginning, can i use the event also?

So when i start the gamemode, the vehicle spawn, can i use then onVehicleRespawn, for that to set something for the veicle? I don't see a OnVehicleSpawn, so i think this is possible... I can't try, my pc is a little bit broken,,, :?

Link to comment

Ok, forgot everything what i have say, i have now two questions.

Question 1:How can i attach something when its spawn, not respawn, just spawn when the gamemode start. There is a onVehicleRespawn, but not a onVehicleSpawn... That says wiki...

Question 2: When i attach a little rc vehicle to a normal plane, and i make a sharp bend with the normal airplane, the rc vehicle

just let loose. It's not attach anymore on the plane. Is this a bug or something? And is there a way to reslove this?

Link to comment
  • 10 years later...

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