Someone help me please
#1

Can someone help me please guys This my problem
Код:
[05:37:32] [debug] Run time error 4: "Array index out of bounds"
[05:37:32] [debug]  Attempted to read/write array element at negative index -1
[05:37:32] [debug] AMX backtrace:
[05:37:32] [debug] #0 0007b800 in ?? (15) in word.amx
[05:37:32] [debug] #1 000c0b3c in public OnQueryFinished (14, 0) in word.amx
Please if u know how to fix it tell me!!
Reply
#2

Show us the code in public OnQueryFinished
Reply
#3

Simple array read/write issue,

Make sure you have required array size.

Like

Код:
new Data[2];
Data[0] = 1;
Data[1] = 2;
Data[2] = 3; // this will throw Array index out of bounds error
Reply
#4

Код:
}


forward OnQueryFinished(threadid, extraid);
public OnQueryFinished(threadid, extraid)
{
	new rows = cache_get_row_count(connectionID);

	switch(threadid)
	{
	    case THREAD_LOOKUP_BANS:
	    {
	        if(rows)
        	{
	            new bannedby[24], date[24], reason[128];

	            cache_get_field_content(0, "bannedby", bannedby);
	            cache_get_field_content(0, "date", date);
	            cache_get_field_content(0, "reason", reason);

	            GameTextForPlayer(extraid, "~r~You are banned!", 999999, 3);
				TextDrawHideForPlayer(extraid, welcomenew);
				if(cache_get_field_content_int(0, "permanent"))
				    SendClientMessageEx(extraid, COLOR_YELLOW, "You are permanently banned from this server.");
				else
					SendClientMessageEx(extraid, COLOR_YELLOW, "You are banned from this server. You can appeal your ban at Deviation.cf.");

				SendClientMessageEx(extraid, COLOR_LIGHTRED, "Admin: %s", bannedby);
	            SendClientMessageEx(extraid, COLOR_LIGHTRED, "Date: %s", date);
	            SendClientMessageEx(extraid, COLOR_LIGHTRED, "Reason: %s", reason);

				KickPlayer(extraid);
	        }
	        else
	        {
	            mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "SELECT uid FROM users WHERE username = '%s'", GetPlayerNameEx(extraid));
				mysql_tquery(connectionID, queryBuffer, "OnQueryFinished", "ii", THREAD_LOOKUP_ACCOUNT, extraid);
	        }
		}
	    case THREAD_LOOKUP_ACCOUNT:
	    {
	        if(rows)
	        {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)