Difference between revisions of "01B2"

From GTAMods Wiki
Jump to navigation Jump to search
 
m
Line 2: Line 2:
 
'''Description''': Gives a weapon to an actor<br>
 
'''Description''': Gives a weapon to an actor<br>
 
'''Parameter 1''': Actor handle<br>
 
'''Parameter 1''': Actor handle<br>
'''Parameter 2''': [[Weapon number]]<br>
+
'''Parameter 2''': [[Weapon#San_Andreas|Weapon number]]<br>
 
'''Parameter 3''': Ammo<br>
 
'''Parameter 3''': Ammo<br>
 
'''Supports''': GTA3, Vice City, San Andreas<br>
 
'''Supports''': GTA3, Vice City, San Andreas<br>
  
This gives a weapon to an actor. Using this opcode requires [[0247]] or else the weapon would not be visible.
+
This gives a weapon to an actor. Using this opcode requires [[0247]] or else the weapon would not be visible and could possibly crash the game.
  
 
==Example==
 
==Example==
Line 28: Line 28:
  
 
==Keywords==
 
==Keywords==
give, actor, weapon
+
give, assign, actor, weapon
  
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 21:25, 7 April 2008

01B2=3,%1d% %2d% %3d%
Description: Gives a weapon to an actor
Parameter 1: Actor handle
Parameter 2: Weapon number
Parameter 3: Ammo
Supports: GTA3, Vice City, San Andreas

This gives a weapon to an actor. Using this opcode requires 0247 or else the weapon would not be visible and could possibly crash the game.

Example

This will be only shown as an example on how to assign a weapon to an actor and shouldn't be copied verbatim. There are other ways of doing this. The following code uses the Sanny Builder.

:LoadModel
0247: load_model #BFORI
0247: load_model #COLT45

:CheckModel
0001: wait 0 ms
00D6: if 1
0248: model #BFORI available
0248: model #COLT45 available
004D: jump_if_false @CheckModel
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
01B2: give_actor 0@ weapon 22 ammo 100
0249: release_model #BFORI
0249: release_model #COLT45
004E: end_thread

Keywords

give, assign, actor, weapon