Server crashing on player death
#1

When a player gets killed the server crashes and i can't figure out why.

This is my OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	Alive[playerid] = 0;
    CheckDelay[playerid] = 10;
    TextDrawHideForPlayer(playerid, Status[playerid]);
	new vehicleid = GetPlayerVehicleID(playerid);
	if(vehicleVariables[vehicleid][vVehicleJob] == 7)
	{
		format(szMessage, sizeof(szMessage), "Job failed.");
		SCM(playerid, COLOR_NOB, szMessage);
		SetVehicleToRespawnEx(vehicleid);
		KillTimer(mowertimer[playerid]);
		MowerMoney[playerid] = 0;
		TextDrawHideForPlayer(playerid,Mower[playerid]);
		playerVariables[playerid][pFarmerMoney] = 0;

	}
	if(PlayerPaintballing[playerid] != 0)
	{
			new string[500];


			new pinfo[128];
			KillP[killerid]++;
			DeathP[playerid]++;

		    format(string, sizeof(string), "You have killed %s. You now have %d kills.",GetName(playerid), KillP[killerid]);
			SendClientMessage(killerid, COLOR_GENANNOUNCE, string);

		    format(string, sizeof(string), "You have been killed by %s.",GetName(killerid));
			SendClientMessage(playerid, COLOR_GENANNOUNCE, string);

	        PlayerPaintballScore[killerid] = KillP[killerid];
		    if(PlayerPaintballScore[killerid] > PaintballWinnerScore)
		    {
		        PaintballWinner = killerid;
	        	PaintballWinnerScore = PlayerPaintballScore[killerid];
	        	foreach(Player,i)
	    	    {
		            if(IsPlayerConnected(i))
		            {
		                if(PlayerPaintballing[i] != 0)
		                {
							format(pinfo,sizeof(pinfo),"%s is now in lead with %d kills.",GetName(PaintballWinner),PaintballWinnerScore);
							SCM(i, COLOR_YELLOW, pinfo);
	   	    	        }
	    	        }
	       		}
	    	}
	    	return 1;
	}
	KillTimer(mowertimer[playerid]);
	if(playerVariables[playerid][pHeadValue] > 0)
	{
	    if(IsPlayerConnected(killerid))
	    {
		    if(playerVariables[killerid][pGroup] == 12)
		    {
		        if(GoChase[killerid] == playerid)
		        {
		        	new string[256];
					new killer[MAX_PLAYER_NAME];
					new name[MAX_PLAYER_NAME];
					GetPlayerName(killerid, killer, sizeof(killer));
					GetPlayerName(playerid, name, sizeof(name));
					playerVariables[killerid][pMoney] += playerVariables[playerid][pHeadValue];
					format(string,128,"<< Hitman %s has fulfilled the contract on %s and collected $%s. Distance: %.0fm. >>",killer,name,playerVariables[playerid][pHeadValue], GetDistanceBetweenPlayers(killerid, playerid));
					SendToGroup(12, COLOR_HITMAN, string);
					playerVariables[playerid][pHeadValue] = -1;
					GotHit[playerid] = 0;
					GetChased[playerid] = 999;
					GoChase[killerid] = 999;
				}
			}
		}
 	}
	new turfkiller, turfplayerid;
	for(new i = 0; i <= sizeof(TurfInfo); i++)
	{
	    if(IsPlayerInTurf(playerid, i) == 1)
	    {
	        turfplayerid = i;
	        break;
	    }
	}
	for(new i = 0; i <= sizeof(TurfInfo); i++)
	{
	    if(IsPlayerInTurf(killerid, i) == 1)
	    {
	        turfkiller = i;
	        break;
	    }
	}
	new string[256];
    if(WarInfo[turfplayerid][wTime] > 0 && WarInfo[turfkiller][wTime] > 0)
		{
			if(turfplayerid == turfkiller)
			{
				if(playerVariables[playerid][pGroup] == WarInfo[turfplayerid][wAttacker] && playerVariables[killerid][pGroup] == WarInfo[turfplayerid][wFaction])
				{
					playerVariables[playerid][pWarDeaths] += 1;
					format(string, sizeof(string), "You have been killed by %s (%i)", playerVariables[killerid][pNormalName], killerid);
					SCM(playerid, COLOR_GENANNOUNCE, string);

					groupVariables[WarInfo[turfkiller][wFaction]][gScore] += 1;
					playerVariables[killerid][pWarScore] += 1;
					format(string, sizeof(string), "You have killed %s (%i).", playerVariables[playerid][pNormalName], playerid);
					SCM(killerid, COLOR_GENANNOUNCE, string);
					SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in the HQ.");
				}
				else if(playerVariables[killerid][pGroup] == WarInfo[turfkiller][wAttacker] && playerVariables[playerid][pGroup] == WarInfo[turfkiller][wFaction])
				{
					playerVariables[playerid][pWarDeaths] += 1;
					format(string, sizeof(string), "You have been killed by %s (%i).", playerVariables[killerid][pNormalName], killerid);
					SCM(playerid, COLOR_GENANNOUNCE, string);

					groupVariables[WarInfo[turfplayerid][wAttacker]][gScore] += 1;
					playerVariables[killerid][pWarScore] += 1;
					format(string, sizeof(string), "You have killed %s (%i).", playerVariables[playerid][pNormalName], playerid);
					SCM(killerid, COLOR_GENANNOUNCE, string);
					SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in group HQ.");
				}
			}
		}
 	if((WarInfo[turfkiller][wTime] != 0 && (WarInfo[turfkiller][wAttacker] == playerVariables[playerid][pGroup] || WarInfo[turfkiller][wFaction] == playerVariables[playerid][pGroup]) && playerVariables[playerid][pGroup] != 0) || (playerVariables[killerid][pGroup] == 1
 	|| playerVariables[killerid][pGroup] == 2 || playerVariables[killerid][pGroup] == 3 || playerVariables[killerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == playerVariables[killerid][pGroup]) || (PlayerPaintballing[killerid] >= 1))
	{

	}
	else
	{
		WantedID[playerid] = killerid;
		SCM(playerid, COLOR_GENANNOUNCE, "{E60000}[KILL]: {FFFFFF}%s murdered you, use [/call 112]. You have 60 seconds to announce the police.");
		WantedIDTime[playerid] = 60;
	}
	//SetTimerEx("Spawn", 3999, 0, "d", playerid);
	SetPlayerHealth(playerid, 0);
	killerid = INVALID_PLAYER_ID;
	return 1;
}
Reply
#2

Hm.. could you use the "CrashDetect", it may give you the reasons.
Reply
#3

if, because they are too codes and do not understand, you better use the "CrashDetect" to show you where the error causes crash

Link: CrashDetect
Reply
#4

I'd say it'd be related to this statement...

Код:
if((WarInfo[turfkiller][wTime] != 0 && (WarInfo[turfkiller][wAttacker] == playerVariables[playerid][pGroup] || WarInfo[turfkiller][wFaction] == playerVariables[playerid][pGroup]) && playerVariables[playerid][pGroup] != 0) || (playerVariables[killerid][pGroup] == 1
 	|| playerVariables[killerid][pGroup] == 2 || playerVariables[killerid][pGroup] == 3 || playerVariables[killerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == playerVariables[killerid][pGroup]) || (PlayerPaintballing[killerid] >= 1))
Why have you got this so long?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)