SA-MP Forums Archive
[HELP] Engine BMX - 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: [HELP] Engine BMX (/showthread.php?tid=514405)



[HELP] Engine BMX - monster010 - 21.05.2014

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);
            }
        }
    }



Re: [HELP] Engine BMX - Konstantinos - 21.05.2014

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;
}