OnPlayerDeath getting stuck at if statment
#1

I keep having issues with this callback where it just stops at an if statement and doesn't continue, I have something like:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
        print("Death1");
        if(gTeam[killerid] == TEAM_POLICE || gTeam[killerid] == TEAM_PUBLICMEDIC)
	{
	        if(gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_PUBLICMEDIC)
	        {
			SendClientMessage(playerid, COLOR_WHITE, "You Were Unfairly Killed - Continuing Previous Life.");
		}

		if(gTeam[playerid] != TEAM_POLICE && gTeam[playerid] != TEAM_PUBLICMEDIC)
		{
		         if(GetPlayerWantedLevel(playerid) < 4)
		         {
				  SendClientMessage(playerid, COLOR_WHITE, "You Were Unfairly Killed - Continuing Previous Life.");

			 }
		}
	}

        print("Death2");
        if(Authorized[playerid])
	{
                ....
It never makes it to the print "Death2".. No errors, no warnings, its not even a cop killing me, I've messed around with this for hours rewriting it and restructuring OnPlayerDeath to no avail.. So I comment the whole statement off and add some more prints in if(Authorized[playerid]), and it just ends up getting stuck on the next if statement in it.

I'm so frustrated, and it must be something simple I'm over looking.
Reply
#2

Have you tried adding debug messages inside the code between "Death1" and "Death2".

The reason I ask this is because I see no reason why "Death2" shouldn't be called, something in the code above it must be stopping the rest of the code fomr being executed.
Reply
#3

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
Have you tried adding debug messages inside the code between "Death1" and "Death2".

The reason I ask this is because I see no reason why "Death2" shouldn't be called, something in the code above it must be stopping the rest of the code fomr being executed.
Correct, I have another print at the very top of that first if statement and its never called, so its not even making it into it.
Reply
#4

Quote:
Originally Posted by happyface
Посмотреть сообщение
Correct, I have another print at the very top of that first if statement and its never called, so its not even making it into it.
Are you being killed by a player, or are you killing yourself?
If the killer is INVALID_KILLER_ID it might give problems because gTeam goes out of bounds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)