26.07.2011, 06:48
I want to warn those who are currently reading this topic, and those who are not aware of this bug so they can help others. Using killerid in top of your OnPlayerDeath function can cause bugs, once the playerid suicides/dies.
First I noticed there was something wrong with my OnPlayerDeath function because it only showed the SendDeathMessage and it didnt fully finish the function, so I was trying to find it out for longer than 40 minutes why it would work. And suddenly it just hitted me after removing everything involved with killerid, and it worked just fine after that. So I've posted this Warning message on forums.
Two Example: Once playerid suicides/dies (killerid not involved)
This post is just to warn the helpers that are NOT AWARE of this bug, so they can assist others.
First I noticed there was something wrong with my OnPlayerDeath function because it only showed the SendDeathMessage and it didnt fully finish the function, so I was trying to find it out for longer than 40 minutes why it would work. And suddenly it just hitted me after removing everything involved with killerid, and it worked just fine after that. So I've posted this Warning message on forums.
Two Example: Once playerid suicides/dies (killerid not involved)
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[playerid][pDeaths] = PlayerInfo[playerid][pDeaths] + 1;
PlayerInfo[killerid][pScore] = PlayerInfo[killerid][pScore] + 1; /*the function will stop/end
here. Because killerid is not involved in playerids suicide/death.*/
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1; //line wont be reached.
PlayerInfo[killerid][pGameKills] = PlayerInfo[killerid][pGameKills] + 1; //line wont be reached.
PlayerInfo[playerid][pScore] = PlayerInfo[playerid][pScore] - 1; //Etc.
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[playerid][pDeaths] = PlayerInfo[playerid][pDeaths] + 1;
PlayerInfo[playerid][pScore] = PlayerInfo[playerid][pScore] - 1;
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
PlayerInfo[killerid][pScore] = PlayerInfo[killerid][pScore] + 1; /*the function will stop/end
here. Because killerid is not involved in playerids suicide/death.*/
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1; //line wont be reached.
PlayerInfo[killerid][pGameKills] = PlayerInfo[killerid][pGameKills] + 1; //line wont be reached.
return 1; //Etc.
}
This post is just to warn the helpers that are NOT AWARE of this bug, so they can assist others.