OnDialogResponse [Debug]
#1

Well, i got a warnings from crashdetect i tried to fix that, i know the reason from ondialogresponse and its appear when i click on a teleport place , but that what i got:
Код:
]+ [debug] Run time error 4: "Array index out of bounds"
[15:19:34]+ [debug]  Accessing element at index 4 past array upper bound 2
[15:19:34]+ [debug] AMX backtrace:
[15:19:34]+ [debug] #0 0004f8a4 in public OnDialogResponse (0x00000000, 0x00000bb1, 0x00000001, 0x00000002, 0x001edc9c) from SPA.amx
Here is the teleport's which causing this problem:
Код:
	if(dialogid == DMAREAS) //
	{
	if(response)
    {
	if(listitem == 0) //
    	{
        new pName[MAX_PLAYER_NAME];
        new string [128];
        if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        new rand = random(sizeof(RandomPlayerSpawns));
        MapLoading(playerid);
        SetPlayerArmour(playerid,50);
    	SetPlayerHealth(playerid,100);
        DMZone[playerid] = 5;
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /BF ] ", pName, playerid);
        SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: For leave dm type /LeaveDm");
        SetPlayerFacingAngle(playerid,176.60);
    	SetPlayerPos(playerid, RandomPlayerSpawnsbf[rand][0], RandomPlayerSpawnsbf[rand][1], RandomPlayerSpawnsbf[rand][2]);
        ResetPlayerWeapons(playerid);
    	GivePlayerWeapon(playerid,36,5000000);
        GivePlayerWeapon(playerid,39,5000000);
        GivePlayerWeapon(playerid,28,5000000);
        GivePlayerWeapon(playerid,30,5000000);
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
    	SetPlayerVirtualWorld(playerid,111);//BF

     }
	if(listitem == 1)
	{
        new pName[MAX_PLAYER_NAME];
        new string [128];
    	if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
       	new rand = random(sizeof(RandomPlayerSpawns));
        SetPlayerHealth(playerid,100);
        GetPlayerName(playerid, pName, sizeof(pName));
    	format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /AREA69 ] ", pName, playerid);
    	SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: For leave dm type /LeaveDm");
        DMZone[playerid] = 2;
  		SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, RandomPlayerSpawnsarea69[rand][0], RandomPlayerSpawnsarea69[rand][1], RandomPlayerSpawnsarea69[rand][2]);
        ResetPlayerWeapons(playerid);
      	GivePlayerWeapon(playerid, 24, 500000);
	    GivePlayerWeapon(playerid, 32, 500000);
        GivePlayerWeapon(playerid, 28, 500000);
        GivePlayerWeapon(playerid, 27, 500000);
        GivePlayerWeapon(playerid, 34, 500000);
	    SetPlayerVirtualWorld(playerid,110);//Area69
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
     }
	if(listitem == 2)
	{
        new pName[MAX_PLAYER_NAME];
        new string [128];
    	if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        SetPlayerHealth(playerid,100);
        GetPlayerName(playerid, pName, sizeof(pName));
    	format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /MINIGUN ] ", pName, playerid);
    	SendClientMessageToAll(COLOR_TELEPORT, string);
        DMZone[playerid] = 3;
       	new rand = random(sizeof(RandomPlayerSpawns));
		SetPlayerPos(playerid, RandomPlayerSpawnsMinigun[rand][0], RandomPlayerSpawnsMinigun[rand][1], RandomPlayerSpawnsMinigun[rand][2]);
  		SetPlayerInterior(playerid, 0);
    	SendClientMessage(playerid, RED,"* Server: For leave dm type /LeaveDm");
        ResetPlayerWeapons(playerid);
   		GivePlayerWeapon(playerid, 38, 100000);
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
    	SetPlayerVirtualWorld(playerid,103);//Minigun

     }
	if(listitem == 3)
	{
        if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        new rand = random(sizeof(RandomPlayerSpawns));
        MapLoading(playerid);
        SetPlayerArmour(playerid,50);
    	SetPlayerHealth(playerid,100);
        DMZone[playerid] = 6;
        new pName[MAX_PLAYER_NAME];
        new string [128];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /WAR ] ", pName, playerid);
        SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: {FFFFFF}For leave dm type {F3FF02}/LeaveDm");
        SetPlayerFacingAngle(playerid,176.60);
		SetPlayerPos(playerid, RandomPlayerSpawnsWar[rand][0], RandomPlayerSpawnsWar[rand][1], RandomPlayerSpawnsWar[rand][2]);
        ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, 31, 800000);
       	GivePlayerWeapon(playerid, 25, 800000);
       	GivePlayerWeapon(playerid, 23, 800000);
       	GivePlayerWeapon(playerid, 34, 800000);
       	GivePlayerWeapon(playerid, 16, 1);
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
    	SetPlayerVirtualWorld(playerid,100);//War

    }
	if(listitem == 4)
	{
        DMZone[playerid] = 7;
        new pName[MAX_PLAYER_NAME];
        new string [128];
        if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        new rand = random(sizeof(RandomPlayerSpawns));
    	SetPlayerHealth(playerid,100);
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,37,9999999);
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /FLAME ] ", pName, playerid);
        SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: {FFFFFF}For leave dm type {F3FF02}/LeaveDm");
     	SetPlayerPos(playerid, RandomPlayerSpawnsFlame[rand][0], RandomPlayerSpawnsFlame[rand][1], RandomPlayerSpawnsFlame[rand][2]);
     	SetPlayerVirtualWorld(playerid,101);//flame
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
      }
	if(listitem == 5)
	{
        new pName[MAX_PLAYER_NAME];
        new string [128];
    	if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        SetPlayerHealth(playerid,100);
        GetPlayerName(playerid, pName, sizeof(pName));
    	format(string, sizeof(string), "[DM] %s has joined DeathMatch [ //WAR2 ] ", pName, playerid);
    	SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: For leave dm type /LeaveDm");
        DMZone[playerid] = 4;
       	new rand = random(sizeof(RandomPlayerSpawns));
		SetPlayerPos(playerid, RandomPlayerSpawnsCtd[rand][0], RandomPlayerSpawnsCtd[rand][1], RandomPlayerSpawnsCtd[rand][2]);
  		SetPlayerInterior(playerid, 5);
        ResetPlayerWeapons(playerid);
   		GivePlayerWeapon(playerid, 16, 10);
   		GivePlayerWeapon(playerid, 31, 1000);
   		GivePlayerWeapon(playerid, 32, 1000);
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
    	SetPlayerVirtualWorld(playerid,102);//War2
	}
	if(listitem == 6)
	{
        new pName[MAX_PLAYER_NAME];
        new string [128];
    	if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        SetPlayerHealth(playerid,159);
        GetPlayerName(playerid, pName, sizeof(pName));
    	format(string, sizeof(string), "[DM] %s has joined DeathMatch Mode [ /SNIPER ] ", pName, playerid);
    	SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: {FFFFFF}For leave dm type {F3FF02}/LeaveDm");
        DMZone[playerid] = 1;
       	new rand = random(sizeof(RandomPlayerSpawns));
		SetPlayerPos(playerid, RandomPlayerSpawnsSniper[rand][0], RandomPlayerSpawnsSniper[rand][1], RandomPlayerSpawnsSniper[rand][2]);
  		SetPlayerInterior(playerid, 0);
   		GivePlayerWeapon(playerid, 34, 1000);
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
    	SetPlayerVirtualWorld(playerid,105);//Sniper
	}
	if(listitem == 7)
	{
    	ShowPlayerDialog(playerid, COPSNROBBERS, DIALOG_STYLE_LIST, "Choose a team:", "{F3FF02}Cop Team - You should kill Robber Team, Desert Eagle-Ak47-ShotGun\n{6EF83C}Robber Team - You should kill Cop Team, Combat-ShotGun-Ak47-Sniper", "Join", "Cancel");
    }
	if(listitem == 8)
	{
        if(DMZone[playerid] == 1) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
        MapLoading(playerid);
        new rand = random(sizeof(RandomPlayerSpawns));
    	SetPlayerHealth(playerid,100);
        ResetPlayerWeapons(playerid);
   		GivePlayerWeapon(playerid, 38, 100000);
        new pName[MAX_PLAYER_NAME];
        new string [128];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "[DM] {F81414}%s {FFFFFF}has joined DeathMatch Mode {C77D87}[ /MINIGUN2 ] ", pName, playerid);
        SendClientMessageToAll(COLOR_TELEPORT, string);
    	SendClientMessage(playerid, RED,"* Server: {FFFFFF}For leave dm type {F3FF02}/LeaveDm");
     	SetPlayerPos(playerid, RandomPlayerSpawnsMinigun2[rand][0], RandomPlayerSpawnsMinigun2[rand][1], RandomPlayerSpawnsMinigun2[rand][2]);
        DMZone[playerid] = 8;
       	SetPlayerVirtualWorld(playerid,104);//minigun2
        if(udb_Exists(pName))
	    {
			dUserSetINT(pName).("InDm",1);
		}
     }
 	if(listitem == 9)
	{
        if(DMZone[playerid] > 0) return ShowPlayerDialog(playerid,TELEWARN,DIALOG_STYLE_MSGBOX,"Error:","Teleporting Error!\n\n- {F3FF02}Sorry, But you can't Teleport to another area while in a Dm Zone","OK","Leave Dm");
    	ShowPlayerDialog(playerid, ZombieVsHuman, DIALOG_STYLE_LIST, "Paradise Mini-Games:", "{F81414}Zombie Team - You should kill The Human Team\n{6EF83C}Human Team - You should kill Zombie Team", "Join Team", "Cancel");
     }
     }
     }
Reply
#2

An array was declared with size of 3 (valid indexes 0, 1 and 2) but the index (4) was invalid (out of bounds).

Load the latest version of crashdetect: https://github.com/Zeex/samp-plugin-...ases/tag/v4.12
Compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info

Re-compile your scripts and start the server. Do again what you did with the teleport place and it may print the line caused it. Post OnDialogResponse too (the part with the teleport place).
Reply
#3

Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           5624 bytes
Code size:           523272 bytes
Data size:          2021708 bytes
Stack/heap size:      16384 bytes; estimated max. usage=3555 cells (14220 bytes)
Total requirements: 2566988 bytes
Reply
#4

@Konstantinos , is that causing crash for my server?
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           5624 bytes
Code size:           523272 bytes
Data size:          2021708 bytes
Stack/heap size:      16384 bytes; estimated max. usage=3555 cells (14220 bytes)
Total requirements: 2566988 bytes
Reply
#5

The above is fine but I meant the debug info in the server log (that crashdetect prints in runtime errors).
Reply
#6

That's all im using latest crashdetect
Код:
[15:38:20]+ Incoming connection: 192.168.1.106:55752
[15:38:20]+ [join] Mahdi has joined the server (0:192.168.1.106)
[15:38:42]+ [debug] Run time error 4: "Array index out of bounds"
[15:38:42]+ [debug]  Accessing element at index 3 past array upper bound 2
[15:38:42]+ [debug] AMX backtrace:
[15:38:42]+ [debug] #0 0004f8f8 in public OnDialogResponse (0x00000000, 0x00000bb1, 0x00000001, 0x00000002, 0x001ed94c) from SPA.amx
[15:38:55]+ [part] Mahdi has left the server (0:1)
Could u check the teleports i already putted it
Reply
#7

Hey i got that now:
Код:
[15:46:02]+ [join] Mahdi has joined the server (0:192.168.1.106)
[15:46:39]+ [debug] Run time error 4: "Array index out of bounds"
[15:46:39]+ [debug]  Accessing element at index 4 past array upper bound 2
[15:46:39]+ [debug] AMX backtrace:
[15:46:39]+ [debug] #0 000651ec in public OnDialogResponse (playerid=0, dialogid=2993, response=1, listitem=1, inputtext[]=@0x001ed340 "Area69") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\SPA.pwn:5822
What that please is that could be fixed?
Reply
#8

pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
...
SetPlayerPos(playerid, RandomPlayerSpawnsbf[rand][0], RandomPlayerSpawnsbf[rand][1], RandomPlayerSpawnsbf[rand][2]);
pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
...
SetPlayerPos(playerid, RandomPlayerSpawnsarea69[rand][0], RandomPlayerSpawnsarea69[rand][1], RandomPlayerSpawnsarea69[rand][2]);
and so on..

That's incorrect. You need to get the size of each array separate and not from RandomPlayerSpawns.

pawn Код:
new rand = random(sizeof(RandomPlayerSpawnsbf));
...
SetPlayerPos(playerid, RandomPlayerSpawnsbf[rand][0], RandomPlayerSpawnsbf[rand][1], RandomPlayerSpawnsbf[rand][2]);
pawn Код:
new rand = random(sizeof(RandomPlayerSpawnsarea69));
...
SetPlayerPos(playerid, RandomPlayerSpawnsarea69[rand][0], RandomPlayerSpawnsarea69[rand][1], RandomPlayerSpawnsarea69[rand][2]);
do the same for the rest.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
...
SetPlayerPos(playerid, RandomPlayerSpawnsbf[rand][0], RandomPlayerSpawnsbf[rand][1], RandomPlayerSpawnsbf[rand][2]);
pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
...
SetPlayerPos(playerid, RandomPlayerSpawnsarea69[rand][0], RandomPlayerSpawnsarea69[rand][1], RandomPlayerSpawnsarea69[rand][2]);
and so on..

That's incorrect. You need to get the size of each array separate and not from RandomPlayerSpawns.

pawn Код:
new rand = random(sizeof(RandomPlayerSpawnsbf));
...
SetPlayerPos(playerid, RandomPlayerSpawnsbf[rand][0], RandomPlayerSpawnsbf[rand][1], RandomPlayerSpawnsbf[rand][2]);
pawn Код:
new rand = random(sizeof(RandomPlayerSpawnsarea69));
...
SetPlayerPos(playerid, RandomPlayerSpawnsarea69[rand][0], RandomPlayerSpawnsarea69[rand][1], RandomPlayerSpawnsarea69[rand][2]);
do the same for the rest.
You'r the best ever i would thank you , thank you! , bro , so when my server was crashing in my vps is that was the reason?
Reply
#10

I cannot guess, it may or may not have been the reason. This is why crashdetect is useful.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)