SA-MP Forums Archive
Unlimited nitro in all cars - 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: Unlimited nitro in all cars (/showthread.php?tid=270941)



Unlimited nitro in all cars - tbedy - 22.07.2011

how to make that all cars when are spawned has nitro which is unlimited, and when i pres KEY_FIRE then nitro start, when i stop click KEY_FIRE then nitro stop....

then nitro only working while i holding KEY_FIRE!


Re: Unlimited nitro in all cars - Basicz - 22.07.2011

pawn Code:
#include < a_samp >

#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if ( HOLDING( KEY_FIRE ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
    {
          AddVehicleComponent( GetPlayerVehicleID( playerid ), 1010 );
    }

    if (  RELEASED( KEY_FIRE ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
    {
          RemoveVehicleComponent( GetPlayerVehicleID( playerid ), 1010 );
    }

    return 1;
}
Add as a new filterscript.