Game freezes after 3 deaths [OnPlayerDeath]
#1

So as the title says the game of the dead player freezes after 3 deaths and can only be solved through rebooting the PC. this is OnPlayerDeath:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(PlayerInfo[killerid][jail] || PlayerInfo[playerid][jail]) return 1;
	if(gPlayerUsingLoopingAnim[playerid])
	{
        gPlayerUsingLoopingAnim[playerid] = 0;
	}
	File::SaveAccount(playerid);
	if(reason == 38 && GetAdminLevel(killerid) && !IsPlayerInAnyVehicle(killerid) && !PlayerTemp[killerid][isevent])
	{
	    new Float:pP[4];
	    GetPlayerPos(playerid,pP[0], pP[1], pP[2]);
	    SetTimerEx("SetPlayerPosExEx", 2000, false, "dfffddd", playerid, pP[0], pP[1], pP[2], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), INVALID_VEHICLE_ID);
	    return 1;
	}
	if(killerid != INVALID_PLAYER_ID && killerid != 54 && killerid != 255)
	{
	    if(PlayerTemp[playerid][onpaint])
		{
			PlayerLoop(i)
		    {
		        if(!PlayerTemp[i][onpaint]) continue;
		        if(PlayerTemp[playerid][pbteam] == 1 && PlayerTemp[killerid][pbteam] == 2)
		        {
		            format(iStr, sizeof(iStr),"[PB]: {CCCCFF}%s {FFFFFF}has killed {66CC00}%s {FFFFFF}with a %s ({CCCCFF}Distance: %dm{FFFFFF})", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
				}
				if(PlayerTemp[playerid][pbteam] == 2 && PlayerTemp[killerid][pbteam] == 1)
		        {
		            format(iStr, sizeof(iStr),"[PB]: {66CC00}%s {FFFFFF}has killed {CCCCFF}%s {FFFFFF}with a %s ({CCCCFF}Distance: %dm{66CC00})", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
				}
				if(PlayerTemp[playerid][pbteam]==PlayerTemp[killerid][pbteam]) // Player killls own team member
		        {
		            format(iStr, sizeof(iStr),"[PB]: {ff0000}%s {FFFFFF}has killed {ff0000}%s {FFFFFF}with a %s ({ff0000}Distance: %dm{FFFFFF})", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
					PlayerInfo[killerid][pbkills] -= 6;
					GivePlayerMoneyEx(killerid, -5600);
				}
				SendClientMessage(i, COLOR_WHITE,iStr);
                OnPlayerKillSpree(killerid);
                PlayerInfo[playerid][pbdeaths]++;
                PlayerInfo[killerid][pbkills]++;
		    }
			return 1;
		}
	    if(PlayerTemp[killerid][isevent])
		{
		    PlayerLoop(i)
		    {
		        if(!PlayerTemp[i][isevent]) continue;
		        SendClientMSG(i, COLOR_YELLOW, "..: [EVENT]: %s has killed %s with a %s (Distance: %dm):..", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
                OnPlayerKillSpree(killerid);
		    }
		    if(PlayerTemp[killerid][isevent] == 5)
		    {
				shipkills[killerid] += 1;
			}
			PlayerTemp[playerid][isevent] = 0;
			return 1;
		}
		if(killerid != INVALID_PLAYER_ID) SendDeathMessage(killerid,playerid,reason);
		{
		    CheckWar();
		    new winpoints;
			{
			    switch(PlayerInfo[playerid][ranklvl])
			    {
			        case 0: winpoints = 15;
			        case 1: winpoints = 10;
			        case 2: winpoints = 5;
			        case 3: winpoints = 2;
			        default: winpoints = 1;
			    }
			}
  		    new takecash;
			{
			    switch(PlayerInfo[playerid][ranklvl])
			    {
			        case 0: takecash = 75000;
			        case 1: takecash = 50000;
			        case 2: takecash = 25000;
			        case 3: takecash = 10000;
			        default: takecash = 0;
			    }
			}
	
		    if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction1") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction2"))
		    {
		        dini_IntSet(warfile, "faction1points", dini_Int(warfile,"faction1points") + winpoints);
        		format(iStr, sizeof(iStr),"{7b94a1}[WAR]{b5cdda} %s has killed %s with the weapon: %s. +%d points",RPName(killerid), RPName(playerid), aWeaponNames[reason], winpoints);
				SendClientMessageToTeam(PlayerInfo[killerid][playerteam], iStr, COLOR_PLAYER_VLIGHTBLUE);
				GivePlayerMoneyEx(playerid, -takecash);
		    }
		    else if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction2") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction1"))
		    {
		        dini_IntSet(warfile, "faction2points", dini_Int(warfile,"faction2points") + winpoints);
		       	format(iStr, sizeof(iStr),"{7b94a1}[WAR]{b5cdda} %s has killed %s with the weapon: %s. +%d points",RPName(killerid), RPName(playerid), aWeaponNames[reason], winpoints);
				SendClientMessageToTeam(PlayerInfo[killerid][playerteam], iStr, COLOR_PLAYER_VLIGHTBLUE);
				GivePlayerMoneyEx(playerid, -takecash);
		    }
		}
		TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Status]);
    	TextDrawHideForPlayer(playerid, TextDraw__News);
    	TextDrawHideForPlayer(playerid, IMtxt);

		new string[ MAX_STRING ], wname[ 40 ], ragione[ 40 ];
		GetWeaponName(reason, wname, sizeof(wname));
	    format( string, sizeof(string), "5..: [DEATH] %s[%d] has been killed by %s[%d] (%s) :..",PlayerName(playerid),playerid, PlayerName(killerid), killerid,wname);
		iEcho( string );
		format( string, sizeof(string), "[KILL] %s has killed %s with a %s", PlayerName(killerid), PlayerName(playerid), wname);
		AppendTo(deathlog, string);
		GetWeaponName(reason,ragione,40);

		if(IsPlayerDriver(killerid) && PlayerInfo[killerid][playerteam]!=SASF && PlayerInfo[killerid][playerteam]!=FBI && PlayerInfo[killerid][playerteam]!=LSPD && PlayerInfo[killerid][power]==0)
		{
			format(iStr, sizeof(iStr),"%s has ran over you in a vehivle.~r~ If you wish to get this player punished -~r~ please press the button below", RPName(killerid));
			ShowPlayerDialog(playerid, 56, DIALOG_STYLE_MSGBOX,"Drive By",iStr,"Yeah","Nope");
		}
		if(killerid != INVALID_PLAYER_ID && IsPlayerInPaintball(killerid))
		{
		    if(PlayerTemp[playerid][pbteam] == 1) PBTeams[PlayerTemp[playerid][onpaint]][redscore]++;
		    else PBTeams[PlayerTemp[playerid][onpaint]][bluescore]++;
		    UpdatePBScore(PlayerTemp[playerid][onpaint], PBTeams[PlayerTemp[playerid][onpaint]][redscore], PBTeams[PlayerTemp[playerid][onpaint]][bluescore]);
		    return 1;
		}

		if(!strlen(ragione))
		{
			ragione="Fists";
		}
	    if(PlayerInfo[playerid][playerlvl] >= 3)
	    {
		    if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam]==LSPD || PlayerInfo[killerid][playerteam]==FBI || PlayerInfo[killerid][playerteam]==SASF)
   			{
				GivePlayerMoneyEx(playerid,-10000);
				SendClientMessage(playerid, COLOR_HELPEROOC, "=======================================================================================");
				SendClientMessage(playerid, COLOR_HELPEROOC, " ");
				SendClientMessage(playerid,COLOR_WHITE,"EVADING: -10.000$ for resistance to the federal law.");
				SendClientMessage(playerid,COLOR_LIGHTGREY, "NOTE: If you think, that the law has abused their powers, take a screen shot and post it on the forums.");
				SendClientMessage(playerid, COLOR_HELPEROOC, " ");
				SendClientMessage(playerid, COLOR_HELPEROOC, "=======================================================================================");

				dini_IntSet(globalstats,"GovernmentBank",dini_Int(globalstats,"GovernmentBank")+5000);

				new stringa[ 128 ];
				format(stringa, sizeof(stringa), "Severely wounded by PD/SASF %s %s for resisting arrest", PlayerInfo[killerid][rankname], PlayerName(killerid));
			}
		}
	}
	else
	{
	    if(PlayerInfo[playerid][power])
	    {
	        PlayerLoop(i)
	        {
	    		SendDeathMessage(killerid, playerid, reason);
			}
			return 1;
		}
	    new string[ 128 ];
	    format(string,sizeof(string), ".:: Suicide: %s has suicided ::.", RPName(playerid));
		if(GetPVarInt(playerid, "SkinSelect") == 0)
		{
			PlayerLoop(i)
			{
				if(PLAYERLIST_authed[i])
				{
					SendClientMessage(i,COLOR_RED, string);
				}
			}
		}
		format( string, sizeof(string), "5..: [DEATH] %s[%d] has suicided :..",PlayerName(playerid),playerid);
		iEcho( string );
		format( string, sizeof(string), "[KILL] %s has killed himself", PlayerName(playerid));
		AppendTo(deathlog, string);
	}

 	return 1;
}
Reply
#2

bump
Reply
#3

bump
Reply
#4

Help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)