27.01.2011, 08:04
hi all ! i have a problem
in my GM zombie team & human team !! & some times when a zombie atack a human (unarmed) & kill the human ! they say "player" die
i know wher the bug come from but i have no idea about how to fix it
this is public OnPlayerDeath(playerid, killerid, reason)
& this is public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) tha bug
so tha bug is that whn a zombie atack tha human ! the human heth go dawn -7hp per atack & when he's heath set to 0 he just die but not buy the zombie = just caus he loos all he's heath !
can some one heap pls
in my GM zombie team & human team !! & some times when a zombie atack a human (unarmed) & kill the human ! they say "player" die
i know wher the bug come from but i have no idea about how to fix it
this is public OnPlayerDeath(playerid, killerid, reason)
Код:
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!");
}
can some one heap pls



this is dont work
?