22.07.2011, 11:32
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;
}