13.09.2009, 14:22
I have a bug in my server. When ANY player dies, player who has ID 0, will be teleported to a place where he was a while ago. But this appears only for ID 0, when any players die, this appears. This is very embarassing, and I want it to be fixed. Here is my onplayerdeath- code.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new playercash;
new playercashkiller;
new killedplayer[MAX_PLAYER_NAME];
new string[256];
playercash = GetPlayerMoney(playerid);
GameTextForPlayer(playerid,"Wasted!",5000,2);
speedwarned[playerid] = 0;
SetPlayerWantedLevel(playerid, 0);
SetPlayerColor(playerid, COLOR_WHITE);
job[playerid] = 0;
Dead[playerid] = 1;
if(killerid == INVALID_PLAYER_ID)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
}
else
{
SendDeathMessage(killerid,playerid,reason);
if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid])) {
GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
format(string, sizeof(string), "Law Department: From this arrest you earned cash price %d for arresting a wanted guy.", bounty[playerid]);
SendClientMessage(killerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been arrested!");
SendClientMessage(playerid, COLOR_BLUE, string);
GivePlayerMoney(killerid, bounty[playerid]);
bounty[playerid] = 0;
}
if(playercash > 0) {
playercashkiller = playercash / 2;
GivePlayerMoney(killerid, playercashkiller);
ResetPlayerMoney(playerid);
}
}
if(playercash > 0)
{
ResetPlayerMoney(playerid);
}
return 1;
}