25.12.2012, 01:38
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
if(PRESSED(KEY_FIRE))
{
if(IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
if(PRESSED(KEY_CROUCH))
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
GivePlayerWeapon(playerid, 46, 500);
}
}
return 1;
}