Someone help me please - 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: Someone help me please (
/showthread.php?tid=662219)
Someone help me please -
Darksoneee - 26.12.2018
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!!
Re: Someone help me please -
aKnoxx - 26.12.2018
Show us the code in public OnQueryFinished
Re: Someone help me please -
iorp - 26.12.2018
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
Re: Someone help me please -
Darksoneee - 26.12.2018
Код:
}
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)
{