01B2
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