Same message with engine
#1

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;
}
Reply
#2

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.
Reply
#3

yes it worked thanks vini
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)