SA-MP Forums Archive
random debug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: random debug (/showthread.php?tid=655430)



random debug - nbx2000 - 21.06.2018

in log of the server this debug appears to me how do I solve it?

[18:29:14] [debug] Run time error 4: "Array index out of bounds"
[18:29:14] [debug] Accessing element at index 29 past array upper bound 12
[18:29:14] [debug] AMX backtrace:
[18:29:14] [debug] #0 00374a50 in public Iter_OnPlayerDisconnect (29, 1) from TEST.amx
[18:29:14] [debug] #1 native CallLocalFunction () from sampsvr-port_2185
[18:29:14] [debug] #2 00009f98 in public SSCANF_OnPlayerDisconnect (29, 1) from TEST.amx
[18:29:14] [debug] #3 00000ac0 in public OnPlayerDisconnect (29, 1) from TEST.amx
Код:
public OnPlayerDisconnect(playerid,reason) {
    for(new slot1 = 0; slot1 < 13; slot1++) {
	  pWeaps[playerid][slot1][0] = 0;
	  pWeaps[playerid][slot1][1] = 0;
	}
    banned[playerid] = 0;
    PlayerInfo[playerid][Cash] = 0;
    PlayerInfo[playerid][vehicleo1] = 0;
    PlayerInfo[playerid][vehicle1] = 0;
    PlayerInfo[playerid][vehicleo2] = 0;
    PlayerInfo[playerid][vehicle2] = 0;
    PlayerInfo[playerid][vehicleo3] = 0;
    PlayerInfo[playerid][vehicle3] = 0;
    PlayerInfo[playerid][vehicleo4] = 0;
    PlayerInfo[playerid][vehicle4] = 0;
    PlayerInfo[playerid][vehicleo5] = 0;
    PlayerInfo[playerid][vehicle5] = 0;
    PlayerInfo[playerid][vehicleo6] = 0;
    PlayerInfo[playerid][vehicle6] = 0;
    PlayerInfo[playerid][vehicleo7] = 0;
    PlayerInfo[playerid][vehicle7] = 0;
    PlayerInfo[playerid][vehicleo8] = 0;
    PlayerInfo[playerid][vehicle8] = 0;
    PlayerInfo[playerid][noCash] = 0;
    PlayerInfo[playerid][sboost] = 0;
    PlayerInfo[playerid][God] = 0; //set god mode to 0 or the disconnecting player
    SetPlayerHealth(playerid, 100.0);
    EstaEnFly[playerid] = 0;
    isAFK[playerid] = 0;
	PlayerInfo[playerid][Hide] = 0;
    InAndrom[playerid] = 0;
    noheal[playerid] = 0;
    PlayerInfo[playerid][blip] = 0;
    PlayerInfo[playerid][Registered] = 0;
    securtyeattemp[playerid] = 0;
    PlayerInfo[playerid][LoggedIn] = 0;
    PlayerInfo[playerid][Level] = 0;
    PlayerInfo[playerid][Password] = 0;
    PlayerInfo[playerid][condoms] = 0;
    PlayerInfo[playerid][Score] = 0;
    PlayerInfo[playerid][Money] = 0;
    PlayerInfo[playerid][hID] = 0;
    PlayerInfo[playerid][hOwned] = 0;
    PlayerInfo[playerid][Caps] = 0;
    PlayerInfo[playerid][Muted] = 0;
    PlayerInfo[playerid][OnDuty] = 0;
    PlayerInfo[playerid][Frozen] = 0;
    PlayerInfo[playerid][Jailed] = 0;
    PlayerInfo[playerid][Kills] = 0;
    PlayerInfo[playerid][Deaths] = 0;
    EscapedConvict[playerid] = 0;
    PlayerInfo[playerid][DoorsLocked] = 0;
    PlayerInfo[playerid][bOwned] = 0;
    HasLawEnforcementRadio[playerid] = 0;
    PlayerInfo[playerid][Time] = 0;
    PlayerInfo[playerid][TimesSpawned] = 0;
    SetPVarInt(playerid,"KilledFlood",0);
	PlayerInfo[playerid][SpamCount] = 0;
    PlayerInfo[playerid][PMBlock] = 0;
    PlayerInfo[playerid][VIP] = 0;
    PlayerInfo[playerid][MR] = 0;
    PlayerInfo[playerid][SAM] = 0;
    PlayerInfo[playerid][GTA] = 0;
    PlayerInfo[playerid][PP] = 0;
    PlayerInfo[playerid][NFS] = 0;
    PlayerInfo[playerid][PL] = 0;
    PlayerInfo[playerid][FEX] = 0;
	WrongpPass[playerid] = 0;
    HasWeedBag[playerid] = 0;
    wantsweed[playerid] = 0;
    JailTimeServed[playerid] = 0;
    wantscure[playerid] = 0;
    copshavevc[playerid] = 0;
    playeronweed[playerid] = 0;
	playertookweed[playerid] = 0;
    PlayerInfo[playerid][bID] = 0;
    VisitReqExpires[playerid] = 0;
    wantsheal[playerid] = 0;
    ReqBkRecent[playerid] = 0;
	InDM[playerid] = 0;
    ReqBk[playerid] = 0;
    banrows[playerid] = 0;
    Tazed[playerid] = 0;
    PlayerInfo[playerid][Bank] = 0;
    PlayerInfo[playerid][Warnings] = 0;
    PlayerInfo[playerid][SpamTime] = 0;
    PlayerInfo[playerid][pSkinID] = 0;
    PlayerInfo[playerid][Skin] = 0;
    RobbedPlyRecent[playerid] = 0;
    HasWallet[playerid] = 0;
    fixedcarrecent[playerid] =0;
    commitedcrimerecently[playerid] = 0;
    InfectedPlyRecent[playerid] = 0;
    VisitReq[playerid] = 0;
    ReportedRecent[playerid] = 0;
    triedtoescaperecent[playerid] = 0;
    cannotescapejail[playerid] = 0;
    noheal[playerid] = 0;
    beenrobbedrecently[playerid] = 0;
    PlayerInfo[playerid][PingTime] = 0;
    OldCash[playerid] = 0;
    cuffed[playerid] = 0;
    CuffedTime[playerid] = 0;
    GotoDisabled[playerid] = 0;
    PlayerInfo[playerid][ConnectTime] = gettime();
    WrongPassword[playerid] = 0;
    PlayerInfo[playerid][PingCount] = 0;
    PlayerInfo[playerid][AX] = 0;
	PlayerInfo[playerid][AY] = 0;
	PlayerInfo[playerid][AZ] = 0;
	PlayerInfo[playerid][AInterior]  = 0;
	PlayerInfo[playerid][AWorld] = 0;
	posx[playerid] = 0;
	posy[playerid] = 0;
	posz[playerid] = 0;
	pinterior[playerid] = 0;
	for(new i; i<PING_MAX_EXCEEDS; i++) PlayerInfo[playerid][pPing][i] = 0;
    if(!gPlayerAnimLibsPreloaded[playerid])
	{
	    PreloadAnimLib(playerid,"AIRPORT");
		PreloadAnimLib(playerid,"Attractors");
		PreloadAnimLib(playerid,"BAR");
		PreloadAnimLib(playerid,"BASEBALL");
		PreloadAnimLib(playerid,"BD_FIRE");
		PreloadAnimLib(playerid,"benchpress");
        PreloadAnimLib(playerid,"BF_injection");
        PreloadAnimLib(playerid,"BIKED");
        PreloadAnimLib(playerid,"BIKEH");
        PreloadAnimLib(playerid,"BIKELEAP");
        PreloadAnimLib(playerid,"BIKES");
        PreloadAnimLib(playerid,"BIKEV");
        PreloadAnimLib(playerid,"BIKE_DBZ");
        PreloadAnimLib(playerid,"BMX");
        PreloadAnimLib(playerid,"BOX");
        PreloadAnimLib(playerid,"BSKTBALL");
        PreloadAnimLib(playerid,"BUDDY");
        PreloadAnimLib(playerid,"BUS");
        PreloadAnimLib(playerid,"CAMERA");
        PreloadAnimLib(playerid,"CAR");
        PreloadAnimLib(playerid,"CAR_CHAT");
        PreloadAnimLib(playerid,"CASINO");
        PreloadAnimLib(playerid,"CHAINSAW");
        PreloadAnimLib(playerid,"CHOPPA");
        PreloadAnimLib(playerid,"CLOTHES");
        PreloadAnimLib(playerid,"COACH");
        PreloadAnimLib(playerid,"COLT45");
        PreloadAnimLib(playerid,"COP_DVBYZ");
        PreloadAnimLib(playerid,"CRIB");
        PreloadAnimLib(playerid,"DAM_JUMP");
        PreloadAnimLib(playerid,"DANCING");
        PreloadAnimLib(playerid,"DILDO");
        PreloadAnimLib(playerid,"DODGE");
        PreloadAnimLib(playerid,"DOZER");
        PreloadAnimLib(playerid,"DRIVEBYS");
        PreloadAnimLib(playerid,"FAT");
        PreloadAnimLib(playerid,"FIGHT_B");
        PreloadAnimLib(playerid,"FIGHT_C");
        PreloadAnimLib(playerid,"FIGHT_D");
        PreloadAnimLib(playerid,"FIGHT_E");
        PreloadAnimLib(playerid,"FINALE");
        PreloadAnimLib(playerid,"FINALE2");
        PreloadAnimLib(playerid,"Flowers");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"Freeweights");
        PreloadAnimLib(playerid,"GANGS");
        PreloadAnimLib(playerid,"GHANDS");
        PreloadAnimLib(playerid,"GHETTO_DB");
        PreloadAnimLib(playerid,"goggles");
        PreloadAnimLib(playerid,"GRAFFITI");
        PreloadAnimLib(playerid,"GRAVEYARD");
        PreloadAnimLib(playerid,"GRENADE");
        PreloadAnimLib(playerid,"GYMNASIUM");
        PreloadAnimLib(playerid,"HAIRCUTS");
        PreloadAnimLib(playerid,"HEIST9");
        PreloadAnimLib(playerid,"INT_HOUSE");
        PreloadAnimLib(playerid,"INT_OFFICE");
        PreloadAnimLib(playerid,"INT_SHOP");
        PreloadAnimLib(playerid,"JST_BUISNESS");
        PreloadAnimLib(playerid,"KART");
        PreloadAnimLib(playerid,"KISSING");
        PreloadAnimLib(playerid,"KNIFE");
        PreloadAnimLib(playerid,"LAPDAN1");
        PreloadAnimLib(playerid,"LAPDAN2");
        PreloadAnimLib(playerid,"LAPDAN3");
        PreloadAnimLib(playerid,"LOWRIDER");
        PreloadAnimLib(playerid,"MD_CHASE");
        PreloadAnimLib(playerid,"MEDIC");
        PreloadAnimLib(playerid,"MD_END");
        PreloadAnimLib(playerid,"MISC");
        PreloadAnimLib(playerid,"MTB");
        PreloadAnimLib(playerid,"MUSCULAR");
        PreloadAnimLib(playerid,"NEVADA");
        PreloadAnimLib(playerid,"ON_LOOKERS");
        PreloadAnimLib(playerid,"OTB");
        PreloadAnimLib(playerid,"PARACHUTE");
        PreloadAnimLib(playerid,"PARK");
        PreloadAnimLib(playerid,"PAULNMAC");
        PreloadAnimLib(playerid,"PED");
        PreloadAnimLib(playerid,"PLAYER_DVBYS");
        PreloadAnimLib(playerid,"PLAYIDLES");
        PreloadAnimLib(playerid,"POLICE");
        PreloadAnimLib(playerid,"POOL");
        PreloadAnimLib(playerid,"POOR");
        PreloadAnimLib(playerid,"PYTHON");
        PreloadAnimLib(playerid,"QUAD");
        PreloadAnimLib(playerid,"QUAD_DBZ");
        PreloadAnimLib(playerid,"RIFLE");
        PreloadAnimLib(playerid,"RIOT");
        PreloadAnimLib(playerid,"ROB_BANK");
        PreloadAnimLib(playerid,"ROCKET");
        PreloadAnimLib(playerid,"RUSTLER");
        PreloadAnimLib(playerid,"RYDER");
        PreloadAnimLib(playerid,"SCRATCHING");
        PreloadAnimLib(playerid,"SHAMAL");
        PreloadAnimLib(playerid,"SHOTGUN");
        PreloadAnimLib(playerid,"SILENCED");
        PreloadAnimLib(playerid,"SKATE");
        PreloadAnimLib(playerid,"SPRAYCAN");
        PreloadAnimLib(playerid,"STRIP");
        PreloadAnimLib(playerid,"SUNBATHE");
        PreloadAnimLib(playerid,"SWAT");
        PreloadAnimLib(playerid,"SWEET");
        PreloadAnimLib(playerid,"SWIM");
        PreloadAnimLib(playerid,"SWORD");
        PreloadAnimLib(playerid,"TANK");
        PreloadAnimLib(playerid,"TATTOOS");
        PreloadAnimLib(playerid,"TEC");
        PreloadAnimLib(playerid,"TRAIN");
        PreloadAnimLib(playerid,"TRUCK");
        PreloadAnimLib(playerid,"UZI");
        PreloadAnimLib(playerid,"VAN");
        PreloadAnimLib(playerid,"VENDING");
        PreloadAnimLib(playerid,"VORTEX");
        PreloadAnimLib(playerid,"WAYFARER");
        PreloadAnimLib(playerid,"WEAPONS");
        PreloadAnimLib(playerid,"WUZI");
        PreloadAnimLib(playerid,"SNM");
        PreloadAnimLib(playerid,"BLOWJOBZ");
        PreloadAnimLib(playerid,"SEX");
   		PreloadAnimLib(playerid,"BOMBER");
   		PreloadAnimLib(playerid,"RAPPING");
    	PreloadAnimLib(playerid,"SHOP");
   		PreloadAnimLib(playerid,"BEACH");
   		PreloadAnimLib(playerid,"SMOKING");
    	PreloadAnimLib(playerid,"FOOD");
    	PreloadAnimLib(playerid,"ON_LOOKERS");
    	PreloadAnimLib(playerid,"DEALER");
		PreloadAnimLib(playerid,"CRACK");
		PreloadAnimLib(playerid,"CARRY");
		PreloadAnimLib(playerid,"COP_AMBIENT");
		PreloadAnimLib(playerid,"PARK");
		PreloadAnimLib(playerid,"INT_HOUSE");
		PreloadAnimLib(playerid,"FOOD");
		gPlayerAnimLibsPreloaded[playerid] = 1;
	}
    Delete3DTextLabel(label[playerid]);
    RemovePlayerAttachedObject(playerid, 3);
	if(Reconnecting[playerid] == true) {
	  new string[128];
	  format(string, sizeof(string), "unbanip %s", ReconnectIP[playerid]);
	  SendRconCommand(string);
	  Reconnecting[playerid] = false;
	}
	PlayerInfo[playerid][GoMoney] = 0;
	PlayerInfo[playerid][GoWeapon] = 0;
	TextDrawDestroy(housetext[playerid]);
	TextDrawDestroy(biztext[playerid]);
	TextDrawDestroy(cartext[playerid]);
	KZI_OnPlayerDisconnect(playerid,reason);
	KillTimer(kicktime[playerid]);
	if(PlayerInfo[playerid][Jailed] == 1) KillTimer( JailTimer[playerid] );
	if(PlayerInfo[playerid][Frozen] == 1) KillTimer( FreezeTimer[playerid] );
	if(ServerInfo[Locked] == 1)	KillTimer( LockKickTimer[playerid] );
	new str[128];
	if(PlayerInfo[playerid][blip] == 1) {
	  KillTimer(BlipTimer[playerid]);
	  PlayerInfo[playerid][blip] = 0;
	}
	if(ServerInfo[ConnectMessages] == 1)
	{
		switch (reason) {
			case 0:	format(str, sizeof(str), "*** %s (%d) has left the server (Timeout)", pName(playerid), playerid);
			case 1:	format(str, sizeof(str), "*** %s (%d) has left the server (Leaving)", pName(playerid), playerid);
			case 2:	format(str, sizeof(str), "*** %s (%d) has left the server (Kicked/Banned)", pName(playerid), playerid);
		}
		if(ServerInfo[ConnectMessages] == 1) SendClientMessageToAll(COLOR_Silver, str);
	}
	if(playerInMiniMission[playerid]>0)
	{
		terminarMission(playerid);
	}
	OnBusAsPassenger[playerid]=-1;
	OnTaxiAsPassenger[playerid]=-1;
	#if defined ENABLE_SPEC
    foreach (new x : Player)
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
   		   	AdvanceSpectate(x);
	#endif
	if(RaceParticipant[playerid]>=1)
	{
		if(Participants==1) //Last participant leaving, ending race.
		{
			endrace();
		}
		if(RaceParticipant[playerid] < 3 && RaceStart == 0 && !(RaceParticipant[playerid]==3 && RaceStart == 1))
		{ //Doing readycheck since someone left, but not if they disconnected during countdown.
			ReadyRefresh(playerid);
		}
		Participants--;
		RaceParticipant[playerid]=0;
		DisablePlayerRaceCheckpoint(playerid);
	}
	if(RaceBuilders[playerid] != 0)
	{
   		DisablePlayerRaceCheckpoint(playerid);
		for(new i;i<BCurrentCheckpoints[b(playerid)];i++)
		{
			BRaceCheckpoints[b(playerid)][i][0]=0.0;
   			BRaceCheckpoints[b(playerid)][i][1]=0.0;
			BRaceCheckpoints[b(playerid)][i][2]=0.0;
		}
		BuilderSlots[b(playerid)] = GetMaxPlayers()+1;
		RaceBuilders[playerid] = 0;
	}
	TextDrawHideForPlayer(playerid,vehiclehpbar[playerid]);
	InAndrom[playerid] = 0;
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	  new Query[250];
      format(Query, sizeof(Query),"UPDATE `accounts` SET `Score` = %d,`Money` = %d WHERE `Name` = '%s'",GetPlayerScore(playerid),GetPlayerMoney(playerid),pName(playerid));
      mysql_tquery(mysql, Query, "", "");
      SaveWeapon(playerid);
	}
	return 1;
}



Re: random debug - Calisthenics - 21.06.2018

There is a way to get the line, using: https://github.com/Zeex/samp-plugin-...ith-debug-info

29 is the playerid and was used in array with size of 13. Weapon slots are 13 so have you declare it as the one below?
pawn Код:
new pWeaps[13][MAX_PLAYERS][2];
If this is the case, then it should have been:
pawn Код:
pWeaps[slot1][playerid][0] = 0;
pWeaps[slot1][playerid][1] = 0;
If not, get the line and post the new results.