S_OnPlayerDeath(killerid);
new killer[MAX_PLAYERS], player[MAX_PLAYERS],string[100];
GetPlayerName(playerid, player,sizeof(player));
GetPlayerName(killerid, killer,sizeof(killer));
if((killerid == INVALID_PLAYER_ID) || (killerid == playerid))
{
format(string,sizeof(string), "%s die !.", player);
SendClientMessageToAll(RED,string);
}
else if(infected[playerid] > 0 || team[killerid] == 2)
{
new score = GetPlayerScore(killerid);
GetPlayerName(playerid, player,sizeof(player));
GetPlayerName(killerid, killer,sizeof(killer));
format(string,sizeof(string), "%s has been turned into a zombie by %s(zombie)", player, killer);
SendClientMessageToAll(RED,string);
team[playerid] = 2;
SetPlayerScore(killerid, score+1);
}
if((newkeys & KEY_FIRE) && (team[playerid] == 2))
{
new Float:hp, Float:a;
new target = GetClosestPlayer(playerid);
if(target == INVALID_PLAYER_ID || target == playerid) return 1;
if(team[target] == 2) return 1;
GetPlayerArmour(target,a);
target = GetClosestPlayer(playerid);
if(target == INVALID_PLAYER_ID || target == playerid) return SendClientMessage(playerid, YELLOW, "no human is near you!");
if(GetDistanceBetweenPlayers(playerid,target) <= 2)
{
if(a > 0)
{
SetPlayerArmour(target, a-5);
}
else
{
GetPlayerHealth(target,hp);
SetPlayerHealth(target, hp-7);
}
}
else SendClientMessage(playerid, YELLOW, "Nobody is near you!");
}
(killerid == playerid)
if(killerid != INVALID_PLAYER_ID)
|
the public OnPlayerDeath works perfectly the problem is in OnPlayerKeyStateChange
|
|
if((newkeys & KEY_FIRE) && (team[playerid] == 2)) { new Float:hp, Float:a; new target = GetClosestPlayer(playerid); if(target == INVALID_PLAYER_ID || target == playerid) return 1; if(team[target] == 2) return 1; GetPlayerArmour(target,a); target = GetClosestPlayer(playerid); if(target == INVALID_PLAYER_ID || target == playerid) return SendClientMessage(playerid, YELLOW, "no human is near you!"); if(GetDistanceBetweenPlayers(playerid,target) <= 2) { if(a > 0) { SetPlayerArmour(target, a-5); } else { GetPlayerHealth(target,hp); SetPlayerHealth(target, hp-7); } } else SendClientMessage(playerid, YELLOW, "Nobody is near you!"); } |
|
if((newkeys & KEY_FIRE) && (team[playerid] == 0)) { new Float:hp, Float:a; new target = GetClosestPlayer(playerid); if(target == INVALID_PLAYER_ID || target == playerid) return 1; if(team[target] == 2) return 1; GetPlayerArmour(target,a); target = GetClosestPlayer(playerid); if(target == INVALID_PLAYER_ID || target == playerid) return SendClientMessage(playerid, COLOR_RED, "no human is near you!"); if(GetDistanceBetweenPlayers(playerid,target) <= 2) { if(a > 0) { SetPlayerArmour(target, a-5); } else { GetPlayerHealth(target,hp); SetPlayerHealth(target, hp-7); } } else SendClientMessage(playerid, COLOR_RED, "Nobody is near you!"); } |
this is dont work
?