Jump to content

helmet on a motorbike


Recommended Posts

HI,

 

I have another problem maybe someone can help me.

I want CJ to have a helmet when he is on a motorbike and remove it if he is not on a motorbike.

 

here my code:

 

:

 

HELMO_1

03A4: name_thread 'HELMO'

 

:HELMO_5

0001: wait 250 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££HELMO_5

00D6: if 2

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #BMX

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #BIKE

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #MTBIKE

004D: jump_if_false ££HELMO_5

00D6: if 0

047A: actor $PLAYER_ACTOR driving_a_motorbike

004D: jump_if_false ££HELMO_8

0793: set_player_all_shopping_items_in_possesion_save_configuration

087B: set_player $PLAYER_CHAR apply_shopping_item_texture "HELMET" model "HELMET" item_type 16 ;; 16-byte strings

070D: rebuild_player $PLAYER_CHAR

0002: jump ££HELMO_5

 

:HELMO_8

0784: set_player $PLAYER_CHAR apply_shopping_itemID 0 model 0 item_type 16

070D: rebuild_player $PLAYER_CHAR

0002: jump ££HELMO_5

 

 

The code is working but with weired side effects.

Like aiming with a TEC9 his arms are going up and down fast

And if I want to change clothes in the wardrobe the game crashes.

 

Any ideas what I doing wrong?

 

Link to comment
https://gtaforums.com/topic/270671-helmet-on-a-motorbike/
Share on other sites

well what you expect. coding is ok but you forget:

1. disable it at all costs when other parts of script are messing around shopping items type clothes.

2. you have to use some kind of switch to mark 2 situations:

a- moto-clothes are activated

b- deactivated

in order to avoid changing clothes and rebuilding player every 250ms

 

your command:

0793: set_player_all_shopping_items_in_possesion_save_configuration

does not make sense here

0784: set_player $PLAYER_CHAR apply_shopping_itemID 0 model 0 item_type 16

does not make sense here

 

you are saving config- for what actually if you are never going to load it anyway. you are allpying models NULL but again each 250ms.

 

consider-

:BEGINING

IF

conditions to wear moto-clothes are meet

jf REMOVE

IF

CLOTHES_SWITCH=0

JF BEGINING

set CLOTHES_SWITCH=1

all_shopping_items_in_possesion_save_configuration

player apply moto-clothes

player rebuild

 

:REMOVE

IF

CLOTHES_SWITCH=1

JF BEGINING

all_shopping_items_in_possesion_load_configuration

player rebuild

set CLOTHES_SWITCH=0

 

 

 

 

Link to comment
https://gtaforums.com/topic/270671-helmet-on-a-motorbike/#findComment-4114218
Share on other sites

@PLPynton

Thanks for the reply and the help. It's working now without side effects.

 

Here my code maybe you can check it's realy ok or it could be better.

 


:HELMO_1

03A4: name_thread 'HELMO'

 

:HELMO_5

0001: wait 250 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££HELMO_5

00D6: if 0

047A: actor $PLAYER_ACTOR driving_a_motorbike

004D: jump_if_false ££HELMO_8

00D6: if 2

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #BMX

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #BIKE

80DD: NOT actor $PLAYER_ACTOR driving_vehicle_type #MTBIKE

004D: jump_if_false ££HELMO_5

00D6: if 0

0038: $helm1 == 0

004D: jump_if_false ££HELMO_5

0793: set_player_all_shopping_items_in_possesion_save_configuration

087B: set_player $PLAYER_CHAR apply_shopping_item_texture "HELMET" model "HELMET" item_type 16 ;; 16-byte strings

070D: rebuild_player $PLAYER_CHAR

0004: $helm1 = 1

0002: jump ££HELMO_5

 

:HELMO_8

00D6: if 0

0038: $helm1 == 1

004D: jump_if_false ££HELMO_5

0794: set_player_all_shopping_items_in_possesion_load_configuration

070D: rebuild_player $PLAYER_CHAR

0002: jump ££HELMO_5

Link to comment
https://gtaforums.com/topic/270671-helmet-on-a-motorbike/#findComment-4115358
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.