Player ID 0 Bug
#1

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;
}
Reply
#2

Your OnPlayerDeath seems to be OK.
What is the Dead[playerid] = 1 for?

oh, and BTW,
pawn Код:
if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    }
     else
    {
        SendDeathMessage(killerid,playerid,reason);
    //  [...]
    }
has no point, really, think it over.
Reply
#3

I forgot to delete that Dead[playerid] but it doesn't fix it

What could be the problem?
Reply
#4

The whole thing is a problem, i don't know were to start.
Here's an example.

pawn Код:
if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3 && gTeam[killerid] == TEAM_COPS) {
    GetPlayerName(playerid,playername,32);
    GetPlayerName(killerid,killername,32);
    SetPlayerWantedLevel(playerid, 0);
    IsSpawned[playerid] =0;
    format(msg, sizeof(msg),".:(SUSPECT KILLED):. LOW wanted suspect %s(%d) was taken down by Police Officer %s(%d)",playername,playerid,killername,killerid);
    SendClientMessageToAll(COLOR_LIGHTBLUE, msg);
    ircSay(EchoConnection,EchoChan, msg);
    format(msg, sizeof(msg),"You were taken down by police officer %s(%d)",killername,killerid);
    SendClientMessage(playerid,COLOR_RED, msg);
    format(msg, sizeof(msg),"If you think %s(%d) was breaking the rules, do not revenge kill him type /report id reason for admins!",killername,killerid);
    SendClientMessage(playerid,COLOR_WHITE, msg);
    new mrand = random(10000);
    format(msg, sizeof(msg),"You have been charged $%d by the hospital for their services!",mrand);
    SendClientMessage(playerid,COLOR_RED, msg);
    GivePlayerMoney(playerid, -mrand);
    return 1;
    }
    if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 9 && gTeam[killerid] == TEAM_ARMY) {
    GetPlayerName(playerid,playername,32);
    GetPlayerName(killerid,killername,32);
    SetPlayerWantedLevel(playerid, 0);
    IsSpawned[playerid] =0;
    format(msg, sizeof(msg),".:(SUSPECT KILLED):. LOW wanted suspect %s(%d) was taken down by Army Officer %s(%d)",playername,playerid,killername,killerid);
    SendClientMessageToAll(COLOR_LIGHTBLUE, msg);
    ircSay(EchoConnection,EchoChan, msg);
  format(msg, sizeof(msg),"4.:(ARMY ABUSE):. Army Officer %s(%d) killed low wanted level %s(%d)!",killername,killerid,playername,playerid);
  ircSay(EchoConnection,EchoChan, msg);
    format(msg, sizeof(msg),"You were taken down by army officer %s(%d)",killername,killerid);
    SendClientMessage(playerid,COLOR_RED, msg);
    format(msg, sizeof(msg),"If you think %s(%d) was breaking the rules, do not revenge kill him type /report id reason for admins!",killername,killerid);
    SendClientMessage(playerid,COLOR_WHITE, msg);
    new mrand = random(10000);
    format(msg, sizeof(msg),"You have been charged $%d by the hospital for their services!",mrand);
    SendClientMessage(playerid,COLOR_RED, msg);
    GivePlayerMoney(playerid, -mrand);
    return 1;
    }
Reply
#5

Quote:
Originally Posted by Stevo127
The whole thing is a problem, i don't know were to start.
Here's an example.

pawn Код:
[...]
What? Sorry, I didn't quite get the point of your post...
---
Are you sure, that it happens only when someone dies? And what happens, when the player with ID 0 dies?
Maybe you have some kind of position saving system, and the problem is with that.
Reply
#6

Nothing happens when ID 0 Dies. It doesn't appear in other things
Reply
#7

I got it fixed. I just edited onplayerspawn. You were right position saving system was the problem. Thanks for you too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)