Vehicle engine (SetVehicleParamsEx) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle engine (SetVehicleParamsEx) (
/showthread.php?tid=386588)
Vehicle engine (SetVehicleParamsEx) -
XRabbit - 20.10.2012
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;
}
Re: Vehicle engine (SetVehicleParamsEx) -
RedFusion - 20.10.2012
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
}
}
}
Re: Vehicle engine (SetVehicleParamsEx) -
Memoryz - 20.10.2012
This is what you're looking for:
https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights
Re: Vehicle engine (SetVehicleParamsEx) -
XRabbit - 20.10.2012
Memoryz, thanks, i don't know about this function