26.08.2015, 15:33
First of all,
OnPlayerEnterVehicle is a bad place to put this, this is called when they (attempt) to enter a vehicle, even if locked & or something else happens that prevents them from doing so(such as being killed, being teleported, etc).
OnPlayerStateChange would be a better callback for this, though you should store a variable aswell holding the objectID so you can detect if it's already been added and in future callbacks such as OnVehicleDeath destroy it.
You need to use CreateObject to create the initial object.
OnPlayerEnterVehicle is a bad place to put this, this is called when they (attempt) to enter a vehicle, even if locked & or something else happens that prevents them from doing so(such as being killed, being teleported, etc).
OnPlayerStateChange would be a better callback for this, though you should store a variable aswell holding the objectID so you can detect if it's already been added and in future callbacks such as OnVehicleDeath destroy it.
You need to use CreateObject to create the initial object.