004F
004F=-1,%1p%
Description: Creates a new thread
Parameter 1: Label
+extra parameters
Supports: GTA3, Vice City, San Andreas
This opcode creates a new thread. It begins an execution from the place marked by the label passed as the parameter.
The distinctive feature of this opcode is that it has various number of the parameters. The first parameter (a label) must be always, extra parameters depends on the scripter needs. The aim of using of the extra parameters is to set the values of the local variables of the created thread. The first extra parameter (the second in the opcode) sets the value for the variable 0@, the second extra parameters set the one for 1@ and so on. Total possible number of extra parameters depends on the local variables number for the game: 16+2 for GTA3 and VC, 32+2 for SA. This opcode is similar to opcode 00D7 but with only one parameter, without extra ones.
Example
$VAR = 10
004F: create_thread @MONEY 10 $VAR
...
...
:MONEY
03A4: name_thread 'MONEY'
00D6: if 0
003B: 0@ == 1@
004D: jump_if_false @EXIT
0109: player $PLAYER_CHAR money += 0@
:EXIT
004E: end_thread
When the game starts, it will execute this code and the player will receive 10 dollars.
Keywords
thread, create