SA-MP Forums Archive
Same message with engine - 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: Same message with engine (/showthread.php?tid=343265)



Same message with engine - a!DaN)_)-) - 16.05.2012

Hi when i enter a car its meant to say engine on and engine off but it says engine off for when the engine is actauly of and on heres the code
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new vehicleid,engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
	if(engine == 1)
    {
        SendClientMessage(playerid, COLOR_GREEN, "CAR: ENGINE IS ON!");
        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: /engine to turn off the car");
    }
    if(engine == 0)
    {
         SendClientMessage(playerid, COLOR_RED, "CAR: ENGINE IS OFF!");
         SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: /engine to start the car");
    }
	return 1;
}



Re: Same message with engine - ViniBorn - 16.05.2012

Put this in OnPlayerStateChange.

GetPlayerVehicleID(playerid) don't works fine in OnPlayerEnterVehicle, because it's called when the player press 'F / Enter' , and don't when the player enter the vehicle effectivelly.


Re: Same message with engine - a!DaN)_)-) - 16.05.2012

yes it worked thanks vini