11.02.2010, 15:31
Your Problem is that you will set hit[playerid]=1; as soon as they press fire, then you right after test for it and kill them.
So instead use an else if.
You also/instead might want to disable players weapon.
SetPlayerArmedWeapon(playerid, 0); whenever they press, this way you don't need to worry too much about someone holding down fire.
So instead use an else if.
You also/instead might want to disable players weapon.
SetPlayerArmedWeapon(playerid, 0); whenever they press, this way you don't need to worry too much about someone holding down fire.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new hits =0; //whats this for?
if(IsPlayerInArea(playerid, 1728.8699,-1013.6041, 1699.0139,-1032.5679))
{
if(hit[playerid] == 1 &&(newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
SetPlayerHealth(playerid, 0.0);
hit[playerid] = 0;
}
else if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
SendClientMessage(playerid, COLOR_RED, "You are being warned. Donot fight in the party. Else you will be killed");
SetPlayerArmedWeapon(playerid, 0);
hit[playerid] = 1;
hits++;
}
}
return 1;
}