Difference between revisions of "01B2"

From GTAMods Wiki
Jump to navigation Jump to search
m
Line 5: Line 5:
 
| p2          = [[Weapon]] number
 
| p2          = [[Weapon]] number
 
| p3          = Ammo
 
| p3          = Ammo
| game        = GTA3, Vice City, San Andreas
+
| game        = [[GTA 3]], [[Vice City]], [[San Andreas]]
 
| native      = [[GIVE_WEAPON_TO_CHAR]]
 
| native      = [[GIVE_WEAPON_TO_CHAR]]
 
}}
 
}}
This gives a weapon to a character. Using this opcode requires [[0247]] or else the weapon would not be visible and might possibly crash the game.
+
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==
 
==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.
+
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]].
 
<source lang="scm">
 
<source lang="scm">
 
  :LoadModel
 
  :LoadModel
Line 23: Line 23:
 
  0248:  model #COLT45 available
 
  0248:  model #COLT45 available
 
  004D: jump_if_false @CheckModel
 
  004D: jump_if_false @CheckModel
  009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
+
  009A: 0@ = create_actor_pedtype 4 model #BFORI at 0.0 0.0 0.0
 
  01B2: give_actor 0@ weapon 22 ammo 100
 
  01B2: give_actor 0@ weapon 22 ammo 100
 
  0249: release_model #BFORI
 
  0249: release_model #BFORI
Line 32: Line 32:
 
==Keywords==
 
==Keywords==
 
give, assign, actor, character, weapon
 
give, assign, actor, character, weapon
 
[[Category:OpCodes]]
 

Revision as of 19:09, 27 August 2009

{{{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