26.12.2010, 22:24
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys == KEY_FIRE)
{
new Float:health;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 1.0, x, y, z))
{
new pHealth = GetPlayerHealth(i, health);
SetPlayerHealth(i, pHealth-10);
format(string, sizeof(string), "You have been punched by %s", pName);
PlayerPlaySound(i, 1130, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1130, 0.0, 0.0, 0.0);
SendClientMessage(i, 0xFFFF00AA, string);
}
else
{
SendClientMessage(i, 0xFFFF00AA, "You are not near a vehicle");
}
}
}
}
return 1;
}

