Vehicle engine (SetVehicleParamsEx)
#1

Hello.
I wanna turn off engine of all vehicles, but have a problem with this, when i enter a vehicle - engine is turned on...


Код:
new VehicleEngine [MAX_VEHICLES];
Код:
public OnVehicleSpawn (vehicleid) {
	VehicleEngine [vehicleid] = 0;
	return 1;
}
Код:
public OnPlayerEnterVehicle (playerid, vehicleid, ispassenger) {
	if (GetPlayerState (playerid) == 2) {
		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
		SetVehicleParamsEx(vehicleid, VehicleEngine [vehicleid], lights, alarm, doors, bonnet, boot, 0);
	}
	return 1;
}
Reply
#2

The engine is toggled when you change state to driver, not when you enter the vehicle..
OnPlayerEnterVehicle is called as soon as the player tries to enter it.
pawn Код:
OnPlayerStateChange(playerid, newstate, oldstate)
{
 switch(newstate)
 {
  case PLAYER_STATE_DRIVER:
  {
   //This on the other hand, is called when you're in the car as a driver
  }
 }
}
Reply
#3

This is what you're looking for:

https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights
Reply
#4

Memoryz, thanks, i don't know about this function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)