Difference between revisions of "004F"

From GTAMods Wiki
Jump to navigation Jump to search
m
Line 19: Line 19:
 
  [[004D]]: jump_if_false @EXIT
 
  [[004D]]: jump_if_false @EXIT
 
  [[0109]]: player $PLAYER_CHAR money += 0@
 
  [[0109]]: player $PLAYER_CHAR money += 0@
 
+
 
 
  :EXIT
 
  :EXIT
 
  [[004E]]: end_thread
 
  [[004E]]: end_thread

Revision as of 22:25, 23 December 2008

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.

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 will execute this code, the player get 10 buxes.

Keywords

thread, create