When player die
#1

When player die, onplayerdeath isn't called... Player is on the ground and he can't move until he right click, and he can run and shoot, and everything other... Other players can shoot him, but they cant kill him, until any of admins dont slap him... When he get slap, OnPlayerDeath is called...
Reply
#2

Perhaps show us your OnPlayerDeath() ?
Reply
#3

I think that OnPlayerDeath isn't called, but here is it:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerNPC(playerid)) return 1;
	RemovePlayerAttachedObject(playerid,0);
	RemovePlayerAttachedObject(playerid,1);
	RemovePlayerAttachedObject(playerid,2);
	RemovePlayerAttachedObject(playerid,3);
	RemovePlayerAttachedObject(playerid,4);
	RemovePlayerAttachedObject(playerid,5);
	RemovePlayerAttachedObject(playerid,6);
	RemovePlayerAttachedObject(playerid,7);
	RemovePlayerAttachedObject(playerid,8);
	RemovePlayerAttachedObject(playerid,9);
    // other codes for set variables to 0
	DisablePlayerRaceCheckpoint(playerid);
    DisablePlayerCheckpoint(playerid);
My public OnPlayerDeath have 230 lines... I search on ****** and other who have this problem, other told them to put SetPlayerHealth to player on -1, but i think my OnPlayerDeath isn't called... I will test, but do i need to put anything like that(SetPlayerHealth(playerid, -1)) ??
Reply
#4

I don't think tho, because my OnPlayerDeath is calling automaticlly without any Health.
Reply
#5

Yeah, that bug dont happening always...
Reply
#6

If you don't know if OnPlayerDeath is call, why don't you put a print ?
print("ONPLAYERDEATH CALLED");

You can also put your OnPlayerDeath function on Pastebin and give us the link.
Reply
#7

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
If you don't know if OnPlayerDeath is call, why don't you put a print ?
print("ONPLAYERDEATH CALLED");

You can also put your OnPlayerDeath function on Pastebin and give us the link.

Yepp, onplayerdeath is called... But i dont know what is a problem...

I think then, OnPlayerSpawn isnt called then...

Here is my full OnPlayerDeath: http://pastebin.com/RjCzPLMz
Reply
#8

When a run time error occurs, the code after will not be executed. That happens because you do not check if the killerid is valid player (when a player dies by explosion, falling etc killer is INVALID_PLAYER_ID which is 65535) before using it in arrays and causes Run time error 4: "Array index out of bounds".

I'm talking about those two:
pawn Код:
WarTim[killerid]
WantedLevel[killerid]
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
When a run time error occurs, the code after will not be executed. That happens because you do not check if the killerid is valid player (when a player dies by explosion, falling etc killer is INVALID_PLAYER_ID which is 65535) before using it in arrays and causes Run time error 4: "Array index out of bounds".

I'm talking about those two:
pawn Код:
WarTim[killerid]
WantedLevel[killerid]
Konstantinos, you always help me! Thank you , i fix that mistake, i will write new post if bug happen more.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)