[debug] Run time error 4: "Array index out of bounds"
#1

Code:
[21:05:03] [debug] Run time error 4: "Array index out of bounds"
[21:05:03] [debug]  Attempted to read/write array element at index 65535 in array of size 100
[21:05:03] [debug] AMX backtrace:
[21:05:03] [debug] #0 002d82d0 in public OnPlayerTakeDamage (0, 65535, 1084122727, 54, 3) from Cleveland.amx
[21:07:11] [debug] Server crashed while executing Cleveland.amx
[21:07:11] [debug] AMX backtrace:
[21:07:11] [debug] #0 native KillTimer () from fixes2.so
[21:07:11] [debug] #1 00263760 in public FC_OnPlayerDisconnect (0, 2) from Cleveland.amx
[21:07:11] [debug] #2 native CallLocalFunction () from samp03svr
[21:07:11] [debug] #3 00014e34 in public Itter_OnPlayerDisconnect (0, 2) from Cleveland.amx
[21:07:11] [debug] #4 0000d8d4 in public FIXES_OnPlayerDisconnect (0, 2) from Cleveland.amx
[21:07:11] [debug] #5 000088f8 in public SSCANF_OnPlayerDisconnect (0, 2) from Cleveland.amx
[21:07:11] [debug] #6 00000b04 in public OnPlayerDisconnect (0, 2) from Cleveland.amx
[21:07:11] [debug] #7 native Kick () from samp03svr
[21:07:11] [debug] #8 0000c014 in ?? (0) from Cleveland.amx
[21:07:11] [debug] #9 00360f2c in public KickFix () from Cleveland.amx
[21:07:11] [debug] Native backtrace:
[21:07:11] [debug] #0 f6671180 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[21:07:11] [debug] #1 f6669064 in _ZN11CrashDetect20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[21:07:11] [debug] #2 f6669d64 in _ZN11CrashDetect20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[21:07:11] [debug] #3 f666bcdb in _ZN11CrashDetect7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[21:07:11] [debug] #4 f66704d5 in ?? () from plugins/crashdetect.so
[21:07:11] [debug] #5 f7795420 in ?? ()
[21:07:11] [debug] #6 f74695af in ?? () from plugins/fixes2.so
[21:07:11] [debug] #7 080950e4 in ?? () from ./samp03svr
[21:07:11] [debug] #8 f666aad3 in _ZN11CrashDetect17HandleAMXCallbackEiPiS0_ () from plugins/crashdetect.so
[21:07:11] [debug] #9 0917d888 in ?? () from ▒^Yv▒H^Wv▒         ▒▒▒     ▒▒▒     ▒▒▒     X▒     ▒▒     ^ԡv▒^X
[21:07:11] [debug] Registers:
[21:07:11] [debug] EAX: 00000000 EBX: f746ea48 ECX: f7469590 EDX: f5854a88
[21:07:11] [debug] ESI: 00001080 EDI: 0917d888 EBP: ffa6c9d8 ESP: ffa6c9c0
[21:07:11] [debug] EIP: f74695af EFLAGS: 00010246
[21:07:11] [debug] Stack:
[21:07:11] [debug] ESP+00000000: 00000100 0041723c 00000044 f66621e4
[21:07:11] [debug] ESP+00000020: 0917d888 f5854a88 ffffffff f666214a
[21:07:11] [debug] ESP+00000040: 0917d888 08f0d598 ffa6ce1c f666aad3
Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid){
    new Float:danio, string[128];
    new fuerza = JugadorInfo[issuerid][jFuerza];
	if(issuerid != INVALID_PLAYER_ID){
        if(amount == 2.64){
            switch(fuerza){
	            case 0..10: danio = 5.0;
	            case 11..20: danio = 5.5;
	            case 21..30: danio = 6.0;
	            case 31..40: danio = 6.5;
	            case 41..50: danio = 7.0;
	            case 51..60: danio = 7.5;
	            case 61..70: danio = 8.0;
	            case 71..80: danio = 8.5;
	            case 81..90: danio = 9.0;
	            case 91..10000: danio = 9.5;
           	}
        }
        else{
	        switch(weaponid){
		        case 0:{
		            if(EsPolicia(issuerid) && PuedeEmbestir[issuerid] == 1){
			       		if(Embestido[playerid] == 0 && Paralizado[playerid] == 0){
			          		new embestida = random(4)+1;
			               	if(embestida == 1){
			                	format(string, sizeof(string), "* %s intentу tirar bruscamente a %s en forma de embestida pero no consiguiу embestirlo.", NombreIC(issuerid), NombreIC(playerid));
			                 	ProxDetector(30.0, playerid, string, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES);
			                }
			                else{
			                	format(string, sizeof(string), "* %s intentу tirar bruscamente a %s en forma de embestida y consiguiу hacerlo.", NombreIC(issuerid), NombreIC(playerid));
			                 	ProxDetector(30.0, playerid, string, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES);
			                  	GameTextForPlayer(playerid, "Embestido", 3000, 3);
			                   	TogglePlayerControllable(playerid, 0);
			                    ApplyAnimation(playerid,"PED","BIKE_fallR",4.0,0,1,1,1,0);
			                    ApplyAnimation(playerid,"PED","BIKE_fallR",4.0,0,1,1,1,0);
			                    Embestido[playerid] = 1;
			                    SetTimerEx("LevantarseEmbestido", 3000, false, "i", playerid);
			        		}
			            }
		            }
					switch(fuerza){
		                case 0..10: danio = 2.0;
		                case 11..20: danio = 2.5;
		                case 21..30: danio = 3.0;
		                case 31..40: danio = 3.5;
		                case 41..50: danio = 4.0;
		                case 51..60: danio = 4.5;
		                case 61..70: danio = 5.0;
		                case 71..80: danio = 5.5;
		                case 81..90: danio = 6.0;
		                case 91..10000: danio = 6.5;
					}
			 	}
			 	case 1:{
					switch(fuerza){
		                case 0..10: danio = 2.5;
		                case 11..20: danio = 3.0;
		                case 21..30: danio = 3.5;
		                case 31..40: danio = 4.0;
		                case 41..50: danio = 4.5;
		                case 51..60: danio = 5.0;
		                case 61..70: danio = 5.5;
		                case 71..80: danio = 6.0;
		                case 81..90: danio = 6.5;
		                case 91..10000: danio = 7.0;
              		}
			 	}
			 	case 2,3,5,6,7,15:{
					switch(fuerza){
		                case 0..10: danio = 5.0;
		                case 11..20: danio = 5.5;
		                case 21..30: danio = 6.0;
		                case 31..40: danio = 6.5;
		                case 41..50: danio = 7.0;
		                case 51..60: danio = 7.5;
		                case 61..70: danio = 8.0;
		                case 71..80: danio = 8.5;
		                case 81..90: danio = 9.0;
		                case 91..10000: danio = 9.5;
              		}
			 	}
			 	case 4:{
					switch(fuerza){
		                case 0..10: danio = 6.0;
		                case 11..20: danio = 6.5;
		                case 21..30: danio = 7.0;
		                case 31..40: danio = 7.5;
		                case 41..50: danio = 8.0;
		                case 51..60: danio = 8.5;
		                case 61..70: danio = 9.0;
		                case 71..80: danio = 9.5;
		                case 81..90: danio = 10.0;
		                case 91..10000: danio = 10.5;
              		}
			 	}
			 	case 8:{
		            switch(fuerza){
		               	case 0..10: danio = 8.0;
		                case 11..20: danio = 8.5;
		                case 21..30: danio = 9.0;
		                case 31..40: danio = 9.5;
		                case 41..50: danio = 10.0;
		                case 51..60: danio = 10.5;
		                case 61..70: danio = 11.0;
		                case 71..80: danio = 11.5;
		                case 81..90: danio = 12.0;
		                case 91..10000: danio = 12.5;
					}
				}
			 	case 22: danio = 40.0;
			 	case 23:{
			 	    if(EsPolicia(issuerid) && Taser[issuerid] == 1){
          				if(Paralizado[playerid] == 0){
				 		    danio = 0.0;
 							format(string, sizeof(string), "* %s le efectuу un disparo con un tбser disparador de cables a %s, paralizбndolo.", NombreIC(issuerid), NombreIC(playerid));
      						ProxDetector(30.0, playerid, string, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES);
            				Mensaje(issuerid, COLOR_BLANCO, "Ha logrado paralizarlo con su tбser, para quitarle el parбlisis, utilice el comando '/q(uitar)cables' [ID Jugador].");
                			Mensaje(playerid, COLOR_BLANCO, "Usted ha sido paralizado, para que se le quite el parбlisis, debe esperar a que le quiten los cables.");
							GameTextForPlayer(playerid, "Paralizado", 3000, 3);
     						TogglePlayerControllable(playerid, 0);
           					ApplyAnimation(playerid,"PED","KO_shot_face",4.0,0,1,1,1,0);
           					ApplyAnimation(playerid,"PED","KO_shot_face",4.0,0,1,1,1,0);
                   			Paralizado[playerid] = 1;
                   		}
			 	    }
					else{
					    danio = 40.0;
                    }
			 	}
	    		case 24: danio = 70.0;
	        	case 25:{
			 	    if(EsPolicia(issuerid) && BalasDeGoma[issuerid] == 1){
          				if(Paralizado[playerid] == 0){
				 		    danio = 0.0;
 							format(string, sizeof(string), "* %s le efectuу un disparo con una escopeta de balas de goma %s, paralizбndolo.", NombreIC(issuerid), NombreIC(playerid));
      						ProxDetector(30.0, playerid, string, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES, COLOR_ACCIONES);
            				Mensaje(issuerid, COLOR_BLANCO, "Ha logrado paralizarlo con su escopeta de balas de goma, se le quitarб su parбlisis en 15 segundos.");
                			Mensaje(playerid, COLOR_BLANCO, "Usted ha sido paralizado, se le quitarб el parбlisis en 15 segundos.");
							GameTextForPlayer(playerid, "Paralizado", 3000, 3);
     						TogglePlayerControllable(playerid, 0);
       						ApplyAnimation(playerid, "SWEET", "LaFin_Sweet", 4.0, 0, 1, 1, 1, 0);
       						ApplyAnimation(playerid, "SWEET", "LaFin_Sweet", 4.0, 0, 1, 1, 1, 0);
                 			Paralizado[playerid] = 1;
                 			SetTimerEx("LevantarseParalizado", 15000, false, "i", playerid);
                    	}
			 	    }
					else{
					    danio = 80.0;
                    }
			 	}
	         	case 26: danio = 83.0;
	          	case 27: danio = 85.0;
	          	case 28,32: danio = 20.0;
	          	case 29: danio = 40.0;
	         	case 30: danio = 45.0;
	         	case 31: danio = 44.0;
	         	case 33: danio = 25.0;
	         	case 34: danio = 90.0;
		        default: danio = amount;
	        }
        }
        if(weaponid >= 22 && weaponid <= 34){
            new aviso = random(4)+1;
            if(aviso == 1){
				//
			}
			else{
			    if(GetPlayerInterior(playerid) == 0){
			    	new zona[128];
					GetPlayer2DZone(playerid, zona, 128);
		        	format(string, sizeof(string), "** [CENTRAL] Un sujeto denuncia que se oyen disparos en la zona de %s. **", zona);
	            	MensajeRadioIC(1, COLOR_RADIO, string);
                }
			}
    	}
		TextDrawShowForPlayer(playerid, TextDrawFlashDanio);
        SetPlayerDrunkLevel(playerid, 60000);
        TFlash[playerid] = SetTimerEx("Flash", 250, 1, "i", playerid);
		TMareo[playerid] = SetTimerEx("Mareo", 5000, 1, "i", playerid);
        GetPlayerHealth(playerid, JugadorInfo[playerid][jVida]);
        GetPlayerArmour(playerid, JugadorInfo[playerid][jChaleco]);
        if(JugadorInfo[playerid][jChaleco]){
            if(JugadorInfo[playerid][jChaleco] > danio) EstablecerChaleco(playerid, JugadorInfo[playerid][jChaleco]-danio);
            else{
                EstablecerChaleco(playerid, 0.0);
                JugadorInfo[playerid][jChaleco] = danio-JugadorInfo[playerid][jChaleco];
                if(JugadorInfo[playerid][jChaleco] >= JugadorInfo[playerid][jVida]) EstablecerVida(playerid, 0.0);
                else EstablecerVida(playerid, JugadorInfo[playerid][jVida]-JugadorInfo[playerid][jChaleco]);
            }
        }
        else{
            if(JugadorInfo[playerid][jVida] > danio) EstablecerVida(playerid, JugadorInfo[playerid][jVida]-danio);
            else EstablecerVida(playerid, 0.0);
        }
    }
    return 1;
}
Reply
#2

Your codes an actual cluster fuck. You need to find the line it's originating from.

65535 is INVALID_PLAYER_ID.

Compile your script with -d3. Make a pawn.cfg and put it in pawno/.

https://github.com/Zeex/samp-plugin-...ith-debug-info

Restart the server and check server_log. The line it's originating from should display.
Reply
#3

Code:
[21:35:54] [debug] Server crashed while executing Cleveland.amx
[21:35:54] [debug] AMX backtrace:
[21:35:54] [debug] #0 native KillTimer () from fixes2.so
[21:35:54] [debug] #1 0030786c in public FC_OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\Luis\Desktop\AoTTG\Cleveland RP\gamemodes\Cleveland.pwn:2523
[21:35:54] [debug] #2 native CallLocalFunction () from samp03svr
[21:35:54] [debug] #3 00019158 in public Itter_OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\Luis\Desktop\AoTTG\Cleveland RP\pawno\include\fuckCleo.inc:219
[21:35:54] [debug] #4 0001030c in public FIXES_OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\Luis\Desktop\AoTTG\Cleveland RP\pawno\include\YSI\y_iterate.inc:906
[21:35:54] [debug] #5 0000a23c in public SSCANF_OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\Luis\Desktop\AoTTG\Cleveland RP\pawno\include\fixes.inc:2211
[21:35:54] [debug] #6 00000cc0 in public OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\Luis\Desktop\AoTTG\Cleveland RP\pawno\include\sscanf2.inc:260
[21:35:54] [debug] Native backtrace:
[21:35:54] [debug] #0 f62cb180 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[21:35:54] [debug] #1 f62c3064 in _ZN11CrashDetect20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[21:35:54] [debug] #2 f62c3d64 in _ZN11CrashDetect20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[21:35:54] [debug] #3 f62c5cdb in _ZN11CrashDetect7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[21:35:54] [debug] #4 f62ca4d5 in ?? () from plugins/crashdetect.so
[21:35:54] [debug] #5 f76f9420 in ?? ()
[21:35:54] [debug] #6 f73cc5af in ?? () from plugins/fixes2.so
[21:35:54] [debug] #7 080950e4 in ?? () from ./samp03svr
[21:35:54] [debug] #8 f62c4ad3 in _ZN11CrashDetect17HandleAMXCallbackEiPiS0_ () from plugins/crashdetect.so
2523:
Code:
KillTimer(TimerBarraAgua[playerid]);
Reply
#4

Add a check to make sure playerid isn't an INVALID_PLAYER_ID. See if that fixes it.
Reply
#5

How do i make that?

Forgive me, I'm something new in this.
Reply
#6

Code:
if(playerid != INVALID_PLAYER_ID)
{
     KillTimer(TimerBarraAgua[playerid]);
}
Reply
#7

Need to put that in OnPlayerTakeDamage?
Reply
#8

Put it at the line where the error came from.
Reply
#9

Those two are not related. The run time error is here:
pawn Code:
new fuerza = JugadorInfo[issuerid][jFuerza];
if(issuerid != INVALID_PLAYER_ID){
You need to make sure that issuer is a valid player BEFORE accessing JugadorInfo array.

The crash is caused from fixes2 plugin. All I can do is suggest another timerfix plugin: https://github.com/udan11/samp-plugin-timerfix/releases
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)