[Help]: Invalid instruction, with #emit - 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: [Help]: Invalid instruction, with #emit (
/showthread.php?tid=465381)
[Help]: Invalid instruction, with #emit -
DarkScripter - 22.09.2013
Why this code has generation invalid instruction?
pawn Код:
#include a_samp
stock Func(q)
{
return printf("Hello World: %d", q);
}
main()
{
printf("NON");
#emit LCTRL 6
#emit ADD.C 12
#emit PUSH.C 564 // FISRT PARAMETER
#emit PUSH.C 12
#emit PUSH.PRI
#emit CONST.PRI Func
#emit SCTRL 6
printf("NAIN");
}
Out
pawn Код:
[02:06:38] NON
[02:06:38] Hello World: 564
[02:06:38] Script[gamemodes/test.amx]: Run time error 6: "Invalid instruction"
[02:06:38] Number of vehicle models: 0
[02:06:39] --- Server Shutting Down.
AW: [Help]: Invalid instruction, with #emit -
Nero_3D - 22.09.2013
pawn Код:
main()
{
printf("NON");
// gets the cip behind this
#emit LCTRL 6
// we add 4 bytes for each instruction "ADD.C", "44", "PUSH.C", ...
// we got 11 instructions to get behind sctrl 6 (11 * 4 = 44)
#emit ADD.C 44
#emit PUSH.C 564
// only one parameter, 4 bytes
#emit PUSH.C 4
#emit PUSH.PRI
#emit CONST.PRI Func
#emit SCTRL 6
printf("NAIN");
}
The Invalid instruction mostly came from returning to the position where 564 is saved, 12 bytes behind your lctrl 6