01B2
Jump to navigation
Jump to search
{{{games}}}
- Description
- Gives a weapon to a character
- Syntax
- {{{syntax1}}}
- Parameter
- Native analog
- GIVE_WEAPON_TO_CHAR
This gives a weapon to a character. Using this opcode requires 0247 or else the weapon might not be visible which can crash the game.
Example
This will be only shown as an example on how to assign a weapon to a character 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 and
0248: model #BFORI available
0248: model #COLT45 available
004D: jump_if_false @CheckModel
009A: 0@ = create_actor_pedtype 4 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, character, weapon