26.07.2012, 08:32
Here you are
PHP код:
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(HOLDING(KEY_FIRE))
{
if(IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
else if(RELEASED(KEY_FIRE))
{
if(IsPlayerInAnyVehicle(playerid))
{
RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
return 1;
}