SA-MP Forums Archive
vehilce nitro - 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: vehilce nitro (/showthread.php?tid=380938)



vehilce nitro - JEkvall95 - 27.09.2012

how to make that when you press left mouse key you get nitro

I will ad the funtion to the gamemode


Re: vehilce nitro - newbienoob - 27.09.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new veh = GetPlayerVehicleID(playerid);
        AddVehicleComponent(veh,1010);
        return 1;
    }
    return 1;
}



Re: vehilce nitro - Danyal - 27.09.2012

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE))
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new gpvi = GetPlayerVehicleID(playerid);
            RemoveVehicleComponent(gpvi, 1010);
            AddVehicleComponent(gpvi, 1010);
        }
    }
    return 1;
}