SA-MP Forums Archive
Nos - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Nos (/showthread.php?tid=221625)



Nos - [bs]_lancer - 05.02.2011

hello guys , well im trying somthing and i cant do it ! i wanna use the car nos with one click ! i mean the nos stay off when i click the nos is on when i stop clickin the nos off ! got it ?!

if u understand what i mean and can do it it ! plz send it all here , tnx


Re: Nos - xRyder - 05.02.2011

Haven't tested it but it should work:

pawn Код:
//On top of your script.
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
//OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerVehicleSeat(playerid) == 0)// If the player is a driver
        {
            new vehicle = GetPlayerVehicleID(playerid);

            if(PRESSED(KEY_FIRE))
            {
                AddVehicleComponent(vehicle, 1010); // Adds Nitro.
            }
            else if(RELEASED(KEY_FIRE))
            {
                RemoveVehicleComponent(vehicle,1010); // Removes Nitro.
            }
        }
    }
    return 1;
}



Re: Nos - [bs]_lancer - 05.02.2011

tnx bro . this works great