#1 29-04-2011 17:33

Sabudum
Registered: 19-04-2011
Posts: 3

How to activate car hydraulics and such via code

Does anyone know how to activate car hydraulics and such, as the forklift lifter or the dumper, via scm code?

Offline

#2 29-04-2011 18:40

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: How to activate car hydraulics and such via code

Car hydraulics:

07FF: set_car 4@ hydraulics 1 // enable hydraulics
07F5: car 4@ control_hydraulics 1000.0 0.0 0.0 0.0 // car is lifting (1000.0) some wheel:
// 1000.0 - left front wheel
// 0.0 - left rear wheel
// 0.0 - right front wheel
// 0.0 - right rear wheel

Set angle of extra-part of car (for example, dumper):

08A4: set_car 90@ extra_parts_angle_to 46@  // values: 0.0 - 1.0

Offline

#3 30-04-2011 09:46

ZAZ
Registered: 05-12-2007
Posts: 55

Re: How to activate car hydraulics and such via code

Den_spb wrote:

Car hydraulics:

07FF: set_car 4@ hydraulics 1 // enable hydraulics
07F5: car 4@ control_hydraulics 1000.0 0.0 0.0 0.0 // car is lifting (1000.0) some wheel:
// 1000.0 - left front wheel
// 0.0 - left rear wheel
// 0.0 - right front wheel
// 0.0 - right rear wheel

good post smile
i tried it in the past without success
now i saw your value 1000.0 and tried again successful
important is opcode 03A2:

with spawn car with player inside it needs 03A2: set_car 1@ action 2
for spawn car without player inside it needs 03A2: set_car 1@ action 3
if player left the car it don't works anymore, didn't got it

My script below, press Backspace to spawn a dancing Remington

{$CLEO .cs}
:CarHydraulic_Dance_SpwIFront_1
03A4: name_thread 'CARHSPI' 

:CARHSPI_2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CARHSPI_2
if
0AB0:   key_pressed 8//-----------------------------press backspace 
004D: jump_if_false @CARHSPI_2
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  5.0  0.2
0247: request_model #REMINGTN

:CARHSPI_3
wait  0
if
0248:   model #REMINGTN available
004D: jump_if_false @CARHSPI_3
00A5: 1@ = create_car #REMINGTN at 11@ 12@ 13@
0175: set_car 1@ z_angle_to 90.0
0229: set_car 1@ primary_color_to 1 secondary_color_to 1
06ED: set_car 1@ paintjob 1
0249: release_model #REMINGTN
07FF: set_car 1@ hydraulics 1
03A2: set_car 1@ action 3
wait  250
30@ = 0
31@ = 0
33@ = 0 

:CARHSPI_13
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CARHSPI_95
03F0: enable_text_draw 1
045A: text_draw_1number  40.0  40.0 'NUMBER' 30@    // value
045A: text_draw_1number  40.0  60.0 'NUMBER' 31@    // value
if 
0803:   car 1@ have_hydraulics 
004D: jump_if_false @CARHSPI_95
if  or
0119:     car 1@ wrecked
01F4:     car 1@ flipped
8202:   not actor $PLAYER_ACTOR near_car 1@ radius 50.0 50.0 flag 0 
004D: jump_if_false @CARHSPI_14
jump @CARHSPI_95

:CARHSPI_14
if  and
31@ == 0
00DB:   actor $PLAYER_ACTOR in_car 1@
004D: jump_if_false @CARHSPI_15
31@ = 1
03A2: set_car 1@ action 2
wait 500

:CARHSPI_15
if  and
31@ == 1
80DB: not  actor $PLAYER_ACTOR in_car 1@
004D: jump_if_false @CARHSPI_19
31@ = 0
wait 250
00A6: destroy_car 1@
00BA: text_styled 'fem_off'  1000 ms  4
0002: jump @CARHSPI_2

:CARHSPI_19
if
33@ > 500
004D: jump_if_false @CARHSPI_Table
33@ = 0
0209: 30@ = random_int  0  12

:CARHSPI_Table
0871: init_jump_table 30@ total_jumps  13  0 @CARHSPI_T00 jumps  0 @CARHSPI_T01  1 @CARHSPI_T11  2 @CARHSPI_T22  3 @CARHSPI_T33  4 @CARHSPI_T44  5 @CARHSPI_T55 6 @CARHSPI_T66
0872: jump_table_jumps  7 @CARHSPI_T77  8 @CARHSPI_T88  9 @CARHSPI_T99  10 @CARHSPI_T101  11 @CARHSPI_T111  12 @CARHSPI_T122  -1 @CARHSPI_T00  -1 @CARHSPI_T00  -1 @CARHSPI_T00


:CARHSPI_T00// here goes the code if the value of the variable not exist in the jumptable
00BA: text_styled 'fem_off'  1000 ms  4
wait 1000
0002: jump @CARHSPI_13

:CARHSPI_T01
07F5: car 1@ control_hydraulics 0.0 1000.0 0.0 0.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T11
07F5: car 1@ control_hydraulics 0.0 0.0 0.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T22
07F5: car 1@ control_hydraulics 0.0 0.0 1000.0 0.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T33
07F5: car 1@ control_hydraulics 1000.0 0.0 0.0 0.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T44
07F5: car 1@ control_hydraulics 1000.0 0.0 1000.0 0.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T55
07F5: car 1@ control_hydraulics 0.0 1000.0 0.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T66
07F5: car 1@ control_hydraulics 1000.0 1000.0 0.0 0.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T77
07F5: car 1@ control_hydraulics 0.0 0.0 1000.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T88
07F5: car 1@ control_hydraulics 1000.0 1000.0 1000.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T99
07F5: car 1@ control_hydraulics 0.0 1000.0 1000.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T101
07F5: car 1@ control_hydraulics 1000.0 0.0 1000.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T111
07F5: car 1@ control_hydraulics 1000.0 1000.0 0.0 1000.0
0002: jump @CARHSPI_EXIT

:CARHSPI_T122
07F5: car 1@ control_hydraulics 1000.0 1000.0 1000.0 0.0
0002: jump @CARHSPI_EXIT


:CARHSPI_EXIT
0002: jump @CARHSPI_13




:CARHSPI_95
01C3: remove_references_to_car 1@  // Like turning a car into any random car
00BA: text_styled 'fem_off'  1000 ms  4
0002: jump @CARHSPI_2

Offline

#4 30-04-2011 15:02

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: How to activate car hydraulics and such via code

I looked information for 07F5 in Russian-languge help of Sanny Builder.

My script below, press Backspace to spawn a dancing Remington

Good example.

Offline

#5 13-05-2011 17:05

dcScheeringa
Registered: 13-05-2011
Posts: 1

Re: How to activate car hydraulics and such via code

You know,
I was suffering with same problem,
And after reading this post as well as replies, it is now solved...thanks guys...!

Offline

Board footer

Powered by FluxBB