Difference between revisions of "01B2"

From GTAMods Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
<code>01B2=3,%1d% %2d% %3d%</code><br>
+
{{OpCode
'''Description''': Gives a weapon to an actor<br>
+
| ini        = 01B2=3,%1d% %2d% %3d%
'''Parameter 1''': Actor handle<br>
+
| description = Gives a weapon to a character
'''Parameter 2''': [[Weapon]] number<br>
+
| p1          = Existing actor handle
'''Parameter 3''': Ammo<br>
+
| p2          = [[Weapon]] number
'''Supports''': GTA3, Vice City, San Andreas<br>
+
| p3          = Ammo
 
+
| game        = 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.
+
| 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.
  
 
==Example==
 
==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.
+
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">
<code>:LoadModel<br></code>
+
:LoadModel
<code>[[0247]]: load_model #BFORI</code><br>
+
0247: load_model #BFORI
<code>[[0247]]: load_model #COLT45</code><br>
+
0247: load_model #COLT45
<code></code><br>
+
<code>:CheckModel</code><br>
+
:CheckModel
<code>[[0001]]: wait 0 ms</code><br>
+
0001: wait 0 ms
<code>[[00D6]]: if 1</code><br>
+
00D6: if and
<code>[[0248]]: model #BFORI available</code><br>
+
0248:   model #BFORI available
<code>[[0248]]: model #COLT45 available</code><br>
+
0248:   model #COLT45 available
<code>[[004D]]: jump_if_false @CheckModel</code><br>
+
004D: jump_if_false @CheckModel
<code>[[009A]]: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0</code><br>
+
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
<code>01B2: give_actor 0@ weapon 22 ammo 100</code><br>
+
01B2: give_actor 0@ weapon 22 ammo 100
<code>[[0249]]: release_model #BFORI</code><br>
+
0249: release_model #BFORI
<code>[[0249]]: release_model #COLT45</code><br>
+
0249: release_model #COLT45
<code>[[004E]]: end_thread</code>
+
004E: end_thread
 +
</source>
  
 
==Keywords==
 
==Keywords==
give, assign, actor, weapon
+
give, assign, actor, character, weapon
  
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 23:54, 27 December 2008

{{{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 would not be visible and might possibly 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 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, character, weapon