[HELP] Engine BMX
#1

I try to make, when a player enter on a BMX, the engine to be already on, but....not work. Why?

pawn Код:
if (newkeys & KEY_NO)
    {
        new tmpcar = GetPlayerVehicleID(playerid);
        if(IsABmx(tmpcar))
        {
            Engine[vehicle] = 1;
            return 1;
        }
        if(GetPlayerState(playerid) == 2)
        {
             //This part here is defining the vehicle ID that the player is currently in.
            new engine, lights, alarm, doors, bonnet, boot, objective; //This is defining the vehicles current items.
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This is checking the vehicle's engine/lights/alarm/doors/bonnet/boot/objective status.
            if(Engine[vehicle] == 0) //This is checking if the engine of the vehicle, is turned off or not.
            {
                Engine[vehicle] = 1; //This is setting the global variable that you created at the beginning.
                SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
                GameTextForPlayer(playerid, "~w~ENGINE ~g~ON...", 1000, 6);
            }
            else
            {
                Engine[vehicle] = 0; //This is setting the global variable that you created at the beginning.
                SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
                GameTextForPlayer(playerid, "~w~ENGINE ~r~OFF...", 1000, 6);
            }
        }
    }
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if (GetVehicleModel(vehicleid) == 481)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)