[Problema] El Server Se Apaga En El HOST
#1

Hola Compaсeros Tengo Una Problemilla.

No Se Si Sera El Host, Aunque No Lo Creo.

Cuando Prendo El Server Jugamos Bien Y Eso, Pero Al otro dia que voy a mirar si el server todabia sigue ON, Sale Off.

& Cuando Voy A Los Registros Del HOST Me Sale Este Error. PORFAVOR DEN SOLUCIONES.

Код:
[06:55:06] [debug] Run time error 4: "Array index out of bounds"
[06:55:06] [debug]  Accessing element at index 65535 past array upper bound 499
[06:55:06] [debug] AMX backtrace:
[06:55:06] [debug] #0 0009094c in public OnPlayerDeath (playerid=2, killerid=65535, reason=255) at C:\Users\User\ULTIMA ACTUALIZACION\filterscripts\sadmin.pwn:9082
[06:55:06] [death] TERRO77 died 255
[06:56:59] [debug] Run time error 4: "Array index out of bounds"
[06:56:59] [debug]  Accessing element at negative index -1
[06:56:59] [debug] AMX backtrace:
[06:56:59] [debug] #0 0037e980 in public OnDialogResponse () from GRXLFV6.amx
[06:57:24] [part] TERRO77 has left the server (2:1)
[08:08:34] Incoming connection: 189.158.230.111:1396
[08:08:34] [join] [SWAT]Skyshock[LRD] has joined the server (0:189.158.230.111)
[08:08:35] [{FF0000}[SWAT]Skyshock[LRD]{FFFFFF}] [{FF0000}ID{FFFFFF}:{FF0000}0{FFFFFF}] Ah Entrado Al {FF0000}Server
[08:08:45] -|Login|- [SWAT]Skyshock[LRD] Ah insertado una contraseсa incorrecta (Alfredo9267) intentos: (1)
[08:09:08] [debug] Run time error 4: "Array index out of bounds"
[08:09:08] [debug]  Accessing element at index 65535 past array upper bound 499
[08:09:08] [debug] AMX backtrace:
[08:09:08] [debug] #0 0009094c in public OnPlayerDeath (playerid=0, killerid=65535, reason=255) at C:\Users\User\ULTIMA ACTUALIZACION\filterscripts\sadmin.pwn:9082
[08:09:08] [death] [SWAT]Skyshock[LRD] died 255
[08:09:53] Incoming connection: 189.158.230.111:1399
[08:10:30] Incoming connection: 189.158.230.111:1400
Reply
#2

Se ve claramente el error, pбsanos el CallBack "OnPlayerDeath", el problema estб ahн.
Reply
#3

Quote:
Originally Posted by Edugta.
Посмотреть сообщение
Se ve claramente el error, pбsanos el CallBack "OnPlayerDeath", el problema estб ahн.
EL CODE DE EL CALLBACK.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//----------------------------- [ anti fake kill ] ---------------------------//
    antifakekill[playerid] ++;
    SetTimerEx("antifakekill2", 1000,false,"i",playerid);
//-------------------------- [ bomba nuclear vip ] ---------------------------//
    if(BuscadoPorNuclear[playerid]==1)
	{
		HanDesactivadaoLaBomba[playerid]=1;
	}
//---------------------------------- [ configuracion ] -----------------------//
	BoCmd4[playerid] = 0;
	BoCmd5[playerid] = 0;
	poderesenauto[playerid] = 0;
    TextDrawHideForPlayer(playerid,HAYTD[playerid]);
    JoinedHay[playerid] = 0;
    modoheno[playerid] = 0;
    scoreheno[playerid] = 0;
    tiempohen[playerid] = 0;
//---------------------------------- [ heno ] --------------------------------//
    if(BoCmd3[playerid] == 1)
    {
        BoCmd3[playerid] = 0;
		SetPlayerScore(playerid,GetPlayerScore(playerid)-100);
		PlayerInfo[playerid][Kills] = GetPlayerScore(playerid);
        
        GameTextForPlayer(playerid,"~g~~H~PERDISTE ~w~100 DE SCORE ~g~POR MORIR~n~~w~EN HENO", 3000, 3);
    }
//--------------------------- [ evento ] -------------------------------------//
    if(TaNoEvento[playerid])
    {
        TaNoEvento[playerid] = false;
    }
    if(GetVehicleModel(Cars[playerid]))
    {
        DestroyVehicle(Cars[playerid]);
    }
//------------------------------ [ aquaman ] ---------------------------------//
    new strs[128];
	if(Minigamer_{playerid} == true)
	{
		if(inProgress > 1)
		{
   			format(strs,sizeof(strs),"*"VERDECLARO"%s "BLAN"ha abandonado "ROJOS"aquaman"AZULES" minijuego, "ROJOS"clasificar %d",PlayerName2(playerid),Iter_Count(_Minigamer));
			SendClientMessageToAll(LIME,strs);
			Iter_Remove(_Minigamer,playerid);
			Minigamer_{playerid} = false;
			if(Iter_Count(_Minigamer) < 2)
			{
			    foreach(_Minigamer,i)MinigameWinner(i);
			}
		}
		else
		{
			SendClientMessage(playerid,LIME,""BLAN"Tu entrada para "ROJOS"aquaman"BLAN" minijuego ha sido cancelada." );
			Iter_Remove(_Minigamer,playerid);
			Minigamer_{playerid} = false;
		}
	}
//------------------------------- [ lspec ] ----------------------------------//
	for(new x=0; x<MAX_PLAYERS; x++)
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
	       AdvanceSpectate(x);
//------------------------------- [ flecha ] ---------------------------------//
    if(Empezado == 1)
    {
        if(killerid != INVALID_PLAYER_ID && playerid == Portador)
        {
            AttachObjectToPlayer(Flecha, killerid, 0, 0, 2, 0, 0, 0);
            Portador = killerid;
            GameTextForPlayer(killerid,"~g~~H~GANASTE ~w~20 DE SCORE ~g~POR MATAR~n~~w~AL PORTADOR DE LA FLECHA", 3000, 3);

			SetPlayerScore(killerid,GetPlayerScore(killerid)+20);
			PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);
        }
        else if(killerid == INVALID_PLAYER_ID && playerid == Portador)
        {
        	Suplantar();
        }
    }
//------------------------- [ carreras ] -------------------------------------//
    if(Joined[playerid] == true)
    {
		JoinCount--;
		Joined[playerid] = false;
		DestroyVehicle(CreatedRaceVeh[playerid]);
		DisablePlayerRaceCheckpoint(playerid);
		TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
		TextDrawHideForPlayer(playerid, abandonar[playerid]);
		CPProgess[playerid] = 0;
		franco[playerid][tirador] = 1;
		BoCmd[playerid] = 0;
		KillTimer(InfoTimer[playerid]);
		#if defined RACE_IN_OTHER_WORLD
		SetPlayerVirtualWorld(playerid, 0);
		#endif
	}
	if(BuildRace == playerid+1) BuildRace = 0;
//------------------------------- [ duelos ] ---------------------------------//
    if (EnDuelo[playerid] == 1 && EnDuelo[killerid] == 1)
    {
      for (new i=1; i<= ARENAS; i++)
      {
         if ((Duelos[i][DesaId] == playerid || Duelos[i][DesaId] == killerid) && (Duelos[i][DesafiadoId] == playerid) || (Duelos[i][DesafiadoId] == killerid))
         {
             new str0[128];
             format(str0,sizeof(str0),"-|Info|- Haz perdido el duelo contra %s",PlayerName2(killerid));
             SendClientMessage(playerid,COLOR_DUELO,str0);
             format(str0,sizeof(str0),"-|Info|- Haz ganado el duelo contra %s",PlayerName2(playerid));
             SendClientMessage(killerid,COLOR_DUELO,str0);
             SendClientMessage(killerid,COLOR_DUELO,"-|Info|- Ahora estas en las graderias, para volver a tener un duelo usa /duelo invitar.");
             EnDuelo[playerid] = 0;
             EnDuelo[killerid] = 0;
             BoCmd2[playerid] = 0;
             BoCmd2[killerid] = 0;
             PlayerInfo[playerid][Bloqueado] = 0;
             PlayerInfo[killerid][Bloqueado] = 0;
             PlayerInfo[killerid][Dwin] ++;
             PlayerInfo[playerid][Dlose] ++;
             Duelos[i][DesafiadoId] = -1;
             Duelos[i][DesaId] = -1;
             Duelos[i][ArmasId] = -1;
             Duelos[i][Libre] = 0;
             ShowInformationTxt(killerid);
             ShowInformationTxt(playerid);
             switch (i)
             {
               case 1: {
			           SetPlayerPos(killerid,2626.5664,1206.4237,28.0004);
					   SetPlayerFacingAngle(killerid,274.9405);
					   SetPlayerVirtualWorld(killerid, 0);
					   }
               case 2: {
			           SetPlayerPos(killerid,-1562.8058,310.9799,53.4609);
			           SetPlayerFacingAngle(killerid,278.5559);
					   SetPlayerVirtualWorld(killerid, 0);
					   }
               case 3: {
			           SetPlayerPos(killerid,-2030.9362,-425.7924,71.554);
					   SetPlayerFacingAngle(killerid,145.0746);
					   SetPlayerVirtualWorld(killerid, 0);
					   GivePlayerWeapon(playerid,46,1);
					   }
               case 4: {
			           SetPlayerPos(killerid,2792.4976,-1455.7574,40.048);
					   SetPlayerFacingAngle(killerid,353.4433);
					   SetPlayerVirtualWorld(killerid, 0);
					   }
             }
             for (new j=0; j<= MAX_PLAYERS; j++)
             {
                if (ViendoDuelo[j] == i)
                {
                   new str20[256];
                   format(str20,sizeof(str20),"~r~%s ~w~es el ganador del duelo",PlayerName2(killerid));
                   GameTextForPlayer(j,str20,5000,0);
                   ViendoDuelo[j] =-1;
                   SetPlayerVirtualWorld(j, 0);
                }
             }
             return 1;
         }
      }
    }
    if (EnDuelo[playerid] == 1 && EnDuelo[killerid] == 0)
    {
    }
//--------------------------------- [ hitman ] -------------------------------//
    new playercash;
    new ajustshit[256];
    new killedplayer[MAX_PLAYER_NAME];
	if(killerid == INVALID_PLAYER_ID)
	{
	}
	else
	{
		if(bounty[playerid] > 0)
		{
			GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
			format(ajustshit, sizeof(ajustshit), "Has recibido una recompensa de %d de score por matar a %s.", bounty[playerid], killedplayer);
			SendClientMessage(killerid, COLOR_YELLOW, ajustshit);

			SetPlayerScore(killerid,GetPlayerScore(killerid)+bounty[playerid]);
			PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);
			if(PlayerInfo[killerid][LoggedIn] == 1)
			{
   	   			GuardarDatos(killerid);
   	   			SetPlayerVip(killerid);
   	   			SetPlayerVip2(killerid);
   			}
			ShowInformationTxt(killerid);

			bounty[playerid] = 0;
		}
		if(playercash > 0)
		{
			SetPlayerScore(killerid,GetPlayerScore(killerid)+playercash);
			PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);
			if(PlayerInfo[killerid][LoggedIn] == 1)
			{
   	   			GuardarDatos(killerid);
   	   			SetPlayerVip(killerid);
   	   			SetPlayerVip2(killerid);
   			}
			ShowInformationTxt(killerid);
		}
   	}

   	if(playercash > 0)
   	{
	    ResetPlayerMoney(playerid);
    }
//------------------------------- [ stats ] ----------------------------------//
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);

    SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
    PlayerInfo[playerid][Kills] = GetPlayerScore(playerid);
    
    PlayerInfo[playerid][Deaths]++;
        
   	if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
	{
	    if(GetPlayerWeapon(killerid) == 34){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+5;}
    	if(GetPlayerWeapon(killerid) == 33){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+4;}
    	if(GetPlayerWeapon(killerid) == 32){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+2;}
    	if(GetPlayerWeapon(killerid) == 30){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+3;}
    	if(GetPlayerWeapon(killerid) == 31){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+3;}
    	if(GetPlayerWeapon(killerid) == 29){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+3;}
    	if(GetPlayerWeapon(killerid) == 28){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+2;}
    	if(GetPlayerWeapon(killerid) == 27){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+4;}
    	if(GetPlayerWeapon(killerid) == 26){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+2;}
    	if(GetPlayerWeapon(killerid) == 25){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+5;}
    	if(GetPlayerWeapon(killerid) == 24){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+4;}
    	if(GetPlayerWeapon(killerid) == 23){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+3;}
    	if(GetPlayerWeapon(killerid) == 22){PlayerInfo[killerid][Experiencia]=PlayerInfo[killerid][Experiencia]+3;}
	}
	
    ShowInformationTxt(playerid);
    ShowInformationTxt(killerid);
	
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
   	   	GuardarDatos(playerid);
   	   	SetPlayerVip(playerid);
   	   	SetPlayerVip2(playerid);
	}
   	
	if(PlayerInfo[killerid][LoggedIn] == 1)
	{
   	   	GuardarDatos(killerid);
   	   	SetPlayerVip(killerid);
   	   	SetPlayerVip2(killerid);
   	}
//------------------------ [ mensaje de vida y muerte ] ----------------------//
    SetTimerEx("mvictoria", 3500, 0, "dd",killerid,playerid);

	TextDrawSetString(vmensaje[playerid],KSMensajes[random(sizeof(KSMensajes))]);
	TextDrawShowForPlayer(killerid,vmensaje[playerid]);
	
    new c = random(5);
	{
    	new minfo[400];
    	if (c == 0)
		{
    		format(minfo, sizeof(minfo), "~>~ ~w~~h~eres demaciado lento ~<~");
    		TextDrawSetString(vmensaje[playerid],minfo);
    		TextDrawShowForPlayer(playerid,vmensaje[playerid]);
    		SetTimerEx("mmuerte", 3500, 0, "dd", playerid);
		}
    	else if (c == 1)
		{
    		format(minfo, sizeof(minfo), "~>~ ~w~~h~eres demaciado debil ~<~");
    		TextDrawSetString(vmensaje[playerid], minfo);
    		TextDrawShowForPlayer(playerid,vmensaje[playerid]);
			SetTimerEx("mmuerte", 3500, 0, "dd", playerid);
		}
		else if (c == 2)
		{
			format(minfo, sizeof(minfo), "~>~ ~w~~h~eres un navo ~<~");
    		TextDrawSetString(vmensaje[playerid], minfo);
    		TextDrawShowForPlayer(playerid,vmensaje[playerid]);
    		SetTimerEx("mmuerte", 3500, 0, "dd", playerid);
		}
    	else if (c == 3)
		{
    		format(minfo, sizeof(minfo), "~>~ ~w~~h~contigo me hago premium ~<~");
    		TextDrawSetString(vmensaje[playerid], minfo);
    		TextDrawShowForPlayer(playerid,vmensaje[playerid]);
    		SetTimerEx("mmuerte", 3500, 0, "dd", playerid);
		}
    	else if (c == 4)
		{
    		format(minfo, sizeof(minfo), "~>~ ~w~~h~pierdo balas contigo ~<~");
    		TextDrawSetString(vmensaje[playerid], minfo);
    		TextDrawShowForPlayer(playerid,vmensaje[playerid]);
    		SetTimerEx("mmuerte", 3500, 0, "dd", playerid);
		}
 	}
 	SetPlayerHealth(playerid, 100);
	return 1;
}
Reply
#4

Ok, te explico por quй sucede el error (Espero que entiendas, no me sй explicar muy bien):

En tu CallBack de OnPlayerDeath, en la secciуn de stats tienes el siguiente cуdigo:
pawn Код:
//------------------------------- [ stats ] ----------------------------------//
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);
Lo que significa que al morir, al asesino se le agrega 1 punto, pero hay un simple problema, no estas verificando si el asesino es una ID vбlida, lo cual puede causa error, ya que al suicidarnos, el killerid serб una ID invбlida (INVALID_PLAYER_ID, que es 65535).

Recordemos que tu array, PlayerInfo, tiene un lнmite, el cual me supongo que es 500 (MAX_PLAYERS), pero como no verificas si el asesino es una ID vбlida (500 para abajo en tu caso), el script automбticamente procesa la ID del asesino y le agrega 1 punto, ya sea INVALID_PLAYER_ID o no, y ahн es cuando puede suceder el error, ya que el script intentarб procesar la ID 65535 como ID normal y acceder a la variable normalmente, pero como tu variable tiene un lнmite de 500, da error.

Lo correcto serнa:
pawn Код:
if(killerid != INVALID_PLAYER_ID)
    {
        SetPlayerScore(killerid,GetPlayerScore(killerid) + 1);
        PlayerInfo[killerid][Kills] = GetPlayerScore(killerid);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)