CrashDetect Problem
#1

Hey guys i've a problem.
Код:
[debug] AMX backtrace:
[debug] #0 003b2f3c in ?? (1) from xax.amx
[debug] #1 0021a934 in ?? (1) from xax.amx
[debug] #2 0013b59c in public JBC_OnDialogResponse (1, 1, 1, -1, 38456412) from xax.amx
[debug] #3 native CallLocalFunction () from samp03svr
[debug] #4 00013300 in public OnDialogResponse (1, 1, 1, -1, 38456372) from xax.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at index 43 in array of size 43
Код:
        if(dialogid == 1)
	{
		if(response)
		{
		    if(Find(Ch[playerid][pass],MD5_Hash(inputtext))) LoadCh(playerid);
		    else
			{
				ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "{FFFFFF}Input your pass for login.", "Login", "Exit");
				lright[playerid]++;
			}
		    if(lright[playerid] == 3) Kick(playerid);
		}
		else Kick(playerid);
	}

stock Find(text[], text2[])
{
    if(strfind(text, text2, true) == -1) return 1;
    return 0;
}
Reply
#2

First of all, read this: https://github.com/Zeex/samp-plugin-...ith-debug-info
Second of all, do not use MD5 for passwords! It's broken (there are hash collisions found also it's too fast for a password algorithm).
Thirdly: use a salt with your passwords, pepper would increase security as well.

Right now the suspects are the "lright" array (what's its size?) and maybe "Ch" array. With -d3 you'll know for sure what causes this.

#e: Or maybe the somthing in LoadCh function, dunno without debug info
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
First of all, read this: https://github.com/Zeex/samp-plugin-...ith-debug-info
Second of all, do not use MD5 for passwords! It's broken (there are hash collisions found also it's too fast for a password algorithm).
Thirdly: use a salt with your passwords, pepper would increase security as well.

Right now the suspects are the "lright" array (what's its size?) and maybe "Ch" array. With -d3 you'll know for sure what causes this.

#e: Or maybe the somthing in LoadCh function, dunno without debug info
Код:
[debug] AMX backtrace:
[debug] #0 004b2748 in RemoveVendingMachines (playerid=0) at D:\xax.pwn:64979
[debug] #1 002aba34 in LoadCh (playerid=0) at D:\xax.pwn:45364
[debug] #2 0018cd94 in public JBC_OnDialogResponse (playerid=0, dialogid=1, response=1, listitem=-1, inputtext[]=@024acd98 "secret") at D:\xax.pwn:24787
[debug] #3 native CallLocalFunction () from samp03svr
[debug] #4 00017e30 in public OnDialogResponse (playerid=0, dialogid=1, response=1, listitem=-1, inputtext[]=@024acd70 "secret") at D:\pawno\include\JunkBuster.inc:121
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at index 43 in array of size 43
Код:
RemoveVendingMachines(playerid)
{
	// Remove 24/7 machines
    RemoveBuildingForPlayer(playerid, 1776, -33.8750, -186.7656, 1003.6328, 0.25);
	RemoveBuildingForPlayer(playerid, 1775, -32.4453, -186.6953, 1003.6328, 0.25);

	// Remove all other machines
    for(new i = 0; i < 44; i++)
	{
		RemoveBuildingForPlayer(playerid, 955, VMachines[i][0], VMachines[i][1], VMachines[i][2], 0.50);
		RemoveBuildingForPlayer(playerid, 956, VMachines[i][0], VMachines[i][1], VMachines[i][2], 0.50);
	}
	return 1;


}

new Float:VMachines[43][3] = {
//Candy machines:
{2480.86,-1959.27,12.9609},
{1634.11,-2237.53,12.8906},
{2139.52,-1161.48,23.3594},
{2153.23,-1016.15,62.2344},
{-1350.12,493.859,10.5859},
{-2229.19,286.414,34.7031},
{1659.46,1722.86,10.2188},
{2647.7,1129.66,10.2188},
{2845.73,1295.05,10.7891},
{1398.84,2222.61,10.4219},
{-1455.12,2591.66,55.2344},
{-76.0312,1227.99,19.125},
{662.43,-552.164,15.7109},
{-253.742,2599.76,62.2422},
{2271.73,-76.4609,25.9609},

//Sprunk machines:
{1789.21,-1369.27,15.1641},
{1729.79,-1943.05,12.9453},
{2060.12,-1897.64,12.9297},
{1928.73,-1772.45,12.9453},
{2325.98,-1645.13,14.2109},
{2352.18,-1357.16,23.7734},
{1154.73,-1460.89,15.1562},
{-1350.12,492.289,10.5859},
{-2118.97,-423.648,34.7266},
{-2118.62,-422.414,34.7266},
{-2097.27,-398.336,34.7266},
{-2092.09,-490.055,34.7266},
{-2063.27,-490.055,34.7266},
{-2005.65,-490.055,34.7266},
{-2034.46,-490.055,34.7266},
{-2068.56,-398.336,34.7266},
{-2039.85,-398.336,34.7266},
{-2011.14,-398.336,34.7266},
{-1980.79,142.664,27.0703},
{2319.99,2532.85,10.2188},
{1520.15,1055.27,10.00},
{2503.14,1243.7,10.2188},
{2085.77,2071.36,10.4531},
{-862.828,1536.61,21.9844},
{-14.7031,1175.36,18.9531},
{-253.742,2597.95,62.2422},
{201.016,-107.617,0.898438},
{1277.84,372.516,18.9531}
};
Reply
#4

The size of VMachines array is 43, this means the valid indexes are 0-42. Using sizeof is the best choice so if you add or remove data from the array you won't have to worry about run time error 4 again.

pawn Код:
for(new i = 0; i < sizeof VMachines; i++)
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The size of VMachines array is 43, this means the valid indexes are 0-42. Using sizeof is the best choice so if you add or remove data from the array you won't have to worry about run time error 4 again.

pawn Код:
for(new i = 0; i < sizeof VMachines; i++)
Thanks i works but now i have another problems

Quote:

[debug] AMX backtrace:
[debug] #0 000c9f04 in public OnPlayerDeath (playerid=0, killerid=65535, reason=255) at D:\xax.pwn:7539
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 65535 in array of size 1000

How can killerid be 65535? My array is [MAX_PLAYERS]

And one more;
Код:
[debug] AMX backtrace:
[debug] #0 0001c100 in ShowPlayerBuyable (playerid=0) at D:\pawno\include\mSelection.inc:609
[debug] #1 0001f15c in public Dialog_OnPlayerClickPlayerTD (playerid=0, PlayerText:playertextid=213) at D:\pawno\include\mSelection.inc:933
[debug] #2 0000b840 in public OnPlayerClickPlayerTextDraw (playerid=0, PlayerText:playertextid=213) at D:\pawno\include\dialogs.inc:717
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -399


In mSelection.inc Line 609
gVehicleName[playerid][x] = CreateVehicleName(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, VehicleNames2[gItemList[itemat][mS_ITEM_MODEL]-400], GetVehiclePrice2(gItemList[itemat][mS_ITEM_MODEL]));

In mSelection.inc Line 933
ShowPlayerBuyable(playerid);

stock ShowPlayerBuyable(playerid)
{
	new bgcolor = GetPVarInt(playerid, "mS_previewBGcolor");
    new x=0;
	new Float:BaseX = mS_DIALOG_BASE_X;
	new Float:BaseY = mS_DIALOG_BASE_Y - (mS_SPRITE_DIM_Y * 0.33); // down a bit
	new linetracker = 0;

	new mS_listID = mS_GetPlayerCurrentListID(playerid);
	if(mS_listID == mS_CUSTOM_LISTID)
	{
		new itemat = (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS);
		new Float:rotzoom[4];
		rotzoom[0] = GetPVarFloat(playerid, "mS_custom_Xrot");
		rotzoom[1] = GetPVarFloat(playerid, "mS_custom_Yrot");
		rotzoom[2] = GetPVarFloat(playerid, "mS_custom_Zrot");
		rotzoom[3] = GetPVarFloat(playerid, "mS_custom_Zoom");
		new itemamount = mS_GetAmountOfListItemsEx(playerid);
		// Destroy any previous ones created
		mS_DestroyPlayerMPs(playerid);

		while(x != mS_SELECTION_ITEMS && itemat < (itemamount)) {
			if(linetracker == 0) {
				BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box
				BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
			}
			gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gCustomList[playerid][itemat], BaseX, BaseY, rotzoom[0], rotzoom[1], rotzoom[2], rotzoom[3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);
			gSelectionItemsTag[playerid][x] = gCustomList[playerid][itemat];
			BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
			linetracker++;
			if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0;
			itemat++;
			x++;
		}
	}
	else
	{
		new itemat = (gLists[mS_listID][mS_LIST_START] + (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS));

		// Destroy any previous ones created
		mS_DestroyPlayerMPs(playerid);
		while(x != mS_SELECTION_ITEMS && itemat < (gLists[mS_listID][mS_LIST_END]+1)) {
			if(linetracker == 0) {
				BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box
				BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
			}
			new rzID = gItemList[itemat][mS_ITEM_ROT_ZOOM_ID]; // avoid long line
			if(rzID > -1) gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, gRotZoom[rzID][0], gRotZoom[rzID][1], gRotZoom[rzID][2], gRotZoom[rzID][3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);
			else gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, 0.0, 0.0, 0.0, 1.0, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);

			gVehicleName[playerid][x] = CreateVehicleName(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, VehicleNames2[gItemList[itemat][mS_ITEM_MODEL]-400], GetVehiclePrice2(gItemList[itemat][mS_ITEM_MODEL]));

			gSelectionItemsTag[playerid][x] = gItemList[itemat][mS_ITEM_MODEL];
			BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
			linetracker++;
			if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0;
			itemat++;
			x++;
		}
	}
}
Reply
#6

I solved OnPlayerDeath problem, I added if(killerid != INVALID_PLAYER_ID).

now my server crashing by unknown problem.
Код:
[debug] Server crashed due to an unknown error
[debug] Native backtrace:
[debug] #0 005dadc6 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[debug] #1 005d4bbe in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[debug] #2 005d57e2 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[debug] #3 005d5c86 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[debug] #4 005dabbc in ?? () from plugins/crashdetect.so
[debug] #5 00b3640c in ?? ()
[debug] #6 002601fe in _ZN16CMySQLConnection14ProcessQueriesEv () from plugins/mysql_static.so
[debug] #7 00261cc7 in _ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0Iv16CMySQLConnectionEENS2_5list1INS2_5valueIPS6_EEEEEEE3runEv () from plugins/mysql_static.so
[debug] #8 002f573d in ?? () from plugins/mysql_static.so
[debug] #9 0095cbc9 in ?? () from /lib/libpthread.so.0
[debug] #10 0089edee in clone () from /lib/libc.so.6
Is this problem about my gamemode or my plugins?
Reply
#7

Guys please help me. I've +100 online and my server suddenly crashing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)