The jump to 0 offset is a bug of the games engine. Which is caused by the engine's error. If you're making an endless loop starting from the very beginning of the script, your script will contain a so-called "ZERO JUMP" for instance here is a example:
For instance the jump "script_01" every label there is compiled with a relative offset. So, relative means that this label's position will be calculated from the memory address where a mission or script are located at.
So what is wrong with the script above? What offset? The @script_01 label will have ZERO, as it's linking with the starting point of the script. You can even write jump 0 instead, and it will be compiled same.
The GTA engine processes jumps slightly incorrectly. Come face to a jump 0,
the engine thinks that it's a GLOBAL label, not a LOCAL one. And global labels are processed relatively to the main.scm's starting position, which is 0xA49960 in the games memory. This jump @script_01 actually will lead you to the beginning of the main.scm file, however not your script's beginning. So you will see a buggy-unstable effect of the game restarting it's self.
Solving the problem is very easy, add any opcode(commonly 0000, 0001 or 03A4).
This is now OK, the label will be compiled with offset -2 (0xFFFFFFFE),
negative values are relative by the engine.
Commonly users make this mistake(not putting anything there), if there not aware of this problem in the engine, or they had just forgot, which you will find, may happen quite a lot.
- Code:
// <script start>
:script_01
wait 0
// <script>
jump @script_01
For instance the jump "script_01" every label there is compiled with a relative offset. So, relative means that this label's position will be calculated from the memory address where a mission or script are located at.
So what is wrong with the script above? What offset? The @script_01 label will have ZERO, as it's linking with the starting point of the script. You can even write jump 0 instead, and it will be compiled same.
The GTA engine processes jumps slightly incorrectly. Come face to a jump 0,
the engine thinks that it's a GLOBAL label, not a LOCAL one. And global labels are processed relatively to the main.scm's starting position, which is 0xA49960 in the games memory. This jump @script_01 actually will lead you to the beginning of the main.scm file, however not your script's beginning. So you will see a buggy-unstable effect of the game restarting it's self.
Solving the problem is very easy, add any opcode(commonly 0000, 0001 or 03A4).
- Code:
// <script start>
0000:
:script_01
wait 0
// <script>
jump @script_01
This is now OK, the label will be compiled with offset -2 (0xFFFFFFFE),
negative values are relative by the engine.
Commonly users make this mistake(not putting anything there), if there not aware of this problem in the engine, or they had just forgot, which you will find, may happen quite a lot.