Run time error 6: "Invalid instruction" - 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: Run time error 6: "Invalid instruction" (
/showthread.php?tid=482585)
Run time error 6: "Invalid instruction" -
PakPak - 21.12.2013
Hi there,
I have a problem with my unban, when I try to unban someone who is banned I got this error :
Код:
[14:36:34] [debug] Run time error 6: "Invalid instruction"
[14:36:34] [debug] Unknown opcode 0xb8000000 at address 0x00000069
[14:36:34] [debug] AMX backtrace:
[14:36:34] [debug] #0 00000069 in public cmd_unban () from MyRP.amx
[14:36:34] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[14:36:34] [debug] #2 0000341c in public OnPlayerCommandText () from MyRP.amx
My unban command :
pawn Код:
CMD:unban(playerid, params[])
{
new target;
if(PlayerInfo[playerid][pAdmin] < ADMIN_LVL_SUPER) return ShowInfoForPlayer(playerid, "~r~TOO low", 6000);
if(sscanf(params, "s[40]", target)) return ShowInfoForPlayer(playerid, "~w~USAGE: ~r~/unban~w~ (name)", 6000);
if(IsPlayerBanned(target)) {
new query[200];
format(query, sizeof(query), "DELETE FROM `myrp_bans` WHERE name = '%s'", returnName(playerid));
mysql_function_query(g_Handle, query, true, "", "d", playerid);
new str[256];
format(str,sizeof(str),"%s unban %s",returnName(playerid), target);
SendAdminMessage(COLOR_ORANGE,str);
format(str,sizeof(str),"[UNBAN]%s | %s unban %s",returnTimeDate(), returnName(playerid), target);
log("bans.ini",str);
}
else {
ShowInfoForPlayer(playerid, "~r~Not banned", 6000);
}
return 1;
}
pawn Код:
stock IsPlayerBanned(target)
{
new query[256];
format(query, 70, "SELECT * FROM `myrp_bans` WHERE name = '%s'", target);
mysql_function_query(g_Handle, query, true, "", "d", target);
new rows, fields;
cache_get_data(rows, fields, g_Handle);
if(rows)
{
return true;
}
else {
return false;
}
}
Thanks
Re: Run time error 6: "Invalid instruction" -
Konstantinos - 21.12.2013
https://sampforum.blast.hk/showthread.php?tid=482492
Why did you create another thread for the same problem?
Anyways, I'll say the problems with the code you posted:
pawn Код:
new target;
...
if(sscanf(params, "s[40]", target)) ...
You declared target as an integer and in the sscanf is used as string even if it's not an array.
---
pawn Код:
...
mysql_function_query(g_Handle, query, true, "", "d", target);
new rows, fields;
cache_get_data(rows, fields, g_Handle);
if(rows)
{
return true;
}
else {
return false;
}
Empty callback and threaded queries are not used like that. You'll need to get the data in the callback was used by the function (mysql_function_query) so the best way is an array (global) and store in it true/false so the player can use it later on.