Difference between revisions of "010E"
Jump to navigation
Jump to search
(highlight) |
|||
Line 1: | Line 1: | ||
− | {{Icon| | + | {{OpCode |
− | + | | games = {{Icon|t}} | |
− | + | | command = ALTER_WANTED_LEVEL_NO_DROP | |
− | + | | description = Sets the player's minimum [[wanted level]] | |
− | + | | syntax1 = 010E: set_player [''player handle''] minimum_wanted_level_to [''int''] | |
− | + | | p1t = [''player handle''] | |
− | + | | p1d = The [[0053|handle of the player]] | |
− | + | | p2t = [''int''] | |
− | + | | p2d = Wanted level, range from 0 to 6 | |
− | + | | native = [[ALTER_WANTED_LEVEL_NO_DROP]] | |
− | + | }} | |
− | |||
− | |||
This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode [[010D]]. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained. | This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode [[010D]]. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained. | ||
== Example == | == Example == | ||
− | The following example | + | The following example spawns a ped close to the player. While the ped is hurt but not killed, the player will attain a minimum wanted level of 3. The player can only clear its wanted level after the ped is killed. |
− | < | + | {{Pre|class=sb-code|1= |
− | // set constants | + | <span class="c1">// set constants</span> |
− | const | + | <span class="k">const</span> |
− | CHAR_MODEL = #BFORI | + | CHAR_MODEL = <span class="nt">#BFORI</span> <span class="c1">// set your character model</span> |
− | + | CHAR_HANDLE = <span class="nv">0@</span> | |
− | X_POS = 1@ | + | X_POS = <span class="nv">1@</span> |
− | Y_POS = 2@ | + | Y_POS = <span class="nv">2@</span> |
− | Z_POS = 3@ | + | Z_POS = <span class="nv">3@</span> |
− | + | <span class="k">end</span> | |
− | |||
− | / | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | end | ||
− | |||
− | |||
− | |||
− | </ | ||
− | == | + | <span class="c1">// spawn character</span> |
− | + | [[0247]]: request_model CHAR_MODEL | |
+ | [[038B]]: load_requested_models | ||
+ | [[00A0]]: store_actor <span class="nv">$PLAYER_ACTOR</span> position_to X_POS Y_POS Z_POS | ||
+ | X_POS += <span class="m">4.0</span> | ||
+ | [[009A]]: CHAR_HANDLE = create_actor <span class="m">4</span> CHAR_MODEL at X_POS Y_POS Z_POS | ||
+ | <span class="c1">// attain minimum wanted level</span> | ||
+ | <span class="k">while</span> <span class="k">if</span> [[0118|8118]]: <span class="k">not</span> actor CHAR_HANDLE dead | ||
+ | <span class="k">wait</span> <span class="m">10</span> | ||
+ | <span class="k">if</span> | ||
+ | 8184: <span class="k">not</span> actor CHAR_HANDLE health >= <span class="m">95</span> | ||
+ | <span class="k">then</span> | ||
+ | 010E: set_player <span class="nv">$PLAYER_CHAR</span> minimum_wanted_level_to <span class="m">3</span> | ||
+ | <span class="k">end</span> | ||
+ | <span class="k">end</span> | ||
+ | <span class="c1">// cleanup</span> | ||
+ | [[0249]]: release_model CHAR_MODEL | ||
+ | [[01C2]]: mark_actor_as_no_longer_needed CHAR_HANDLE | ||
+ | }} | ||
− | + | == Keywords == | |
+ | set, change, alter, player, minimum, wanted, level, no, drop |
Latest revision as of 05:54, 15 April 2017
- Description
- Sets the player's minimum wanted level
- Syntax
- 010E: set_player [player handle] minimum_wanted_level_to [int]
- Parameter
- [player handle]
- The handle of the player
- [int]
- Wanted level, range from 0 to 6
- Native analog
- ALTER_WANTED_LEVEL_NO_DROP
This opcode sets the player's current wanted level ranging from 0 to 6, similar to opcode 010D. Unlike 010D, if placed in a loop, the wanted level will not drop below the set value but a higher wanted level can be attained.
Example
The following example spawns a ped close to the player. While the ped is hurt but not killed, the player will attain a minimum wanted level of 3. The player can only clear its wanted level after the ped is killed.
// set constants const CHAR_MODEL = #BFORI // set your character model CHAR_HANDLE = 0@ X_POS = 1@ Y_POS = 2@ Z_POS = 3@ end // spawn character 0247: request_model CHAR_MODEL 038B: load_requested_models 00A0: store_actor $PLAYER_ACTOR position_to X_POS Y_POS Z_POS X_POS += 4.0 009A: CHAR_HANDLE = create_actor 4 CHAR_MODEL at X_POS Y_POS Z_POS // attain minimum wanted level while if 8118: not actor CHAR_HANDLE dead wait 10 if 8184: not actor CHAR_HANDLE health >= 95 then 010E: set_player $PLAYER_CHAR minimum_wanted_level_to 3 end end // cleanup 0249: release_model CHAR_MODEL 01C2: mark_actor_as_no_longer_needed CHAR_HANDLE
Keywords
set, change, alter, player, minimum, wanted, level, no, drop