Community Forum

VehicleLeaveEvent

Forum Overview >> Scripting

CategoryScripting
Created16.08.2016 19:20


Mass Yas (massyas) 16.08.2016 19:37
Hello,

I like to be able to leave a vehicle via a lua script to return to player (pedestrian) like when pressing 'E' key.
The lua script is a global script not linked to a particular vehicle.
I've tried to call g_client:getServerConnection():sendEvent(VehicleLeaveEvent:new(self.currentVehicle);
self.currentVehicle being the controlled vehicle I'd like to leave.

It seems it''s not sufficient since once called, I cannot move the camera or the player but I have the feeling not to be anymore in the vehicle.
I've also tried to set some variables on the vehicle like .isControlled = false or .isEntered = false

Could you share a code snipped I could use to do this ?
Thanks

Mass Yas (massyas) 17.08.2016 20:41
It seems g_currentMission:onLeaveVehicle(g_currentMission.playerStartX, g_currentMission.playerStartY, g_currentMission.playerStartZ); can make the job.
Coud you please confirm it's the right way ?
Thanks


Note: Log in to post. Create a new account here.