Jump to content

Simple script


Bad.boy!

Recommended Posts

Okay, I want to make a simple script, to spawn a car with an actor inside and explode it.

I want to compile the script, but Sanny Builder sais that it's expecting 5 params.

What is wrong?

 

 

 

//-------------MAIN---------------thread 'MISSION':MISSION_2wait 0if 00E1:   player 0 pressed_key 90else_jump @MISSION_2:MISSION_2200A5: 0@ = create_car #BRAVURA at 1919.9373, -2284.0459, 13.5469else_jump @MISSION_22wait 500:MISSION_440129: 1@ = create_actor_pedtype 23 model #SPECIAL02 in_car 0@ driverseatelse_jump @MISSION_44wait 5000:MISSION_56020B: explode_car 0@0003: shake_camera 50else_jump @MISSION_56:MISSION_68jump @MISSION_2   

 

Link to comment
Share on other sites

Remove commas from XYZ coordinates. Only classes requires them to separate each parameter.

 

Also, "else_jump" after 0129, 00A5 and 0003 are useless, as they aren't conditionals.

Link to comment
Share on other sites

Yeah, it might crash when model isn't loaded, means that when no one with this model is near you.

 

Also, you have to select which special actor you want to spawn at first. #SPECIALXX IDs aren't regular peds.

Link to comment
Share on other sites

Okay, this is the script, but I press 'z' and nothing happens

 

 

//-------------MAIN---------------thread 'MISSION':MISSION_2wait 0if 00E1:   player 0 pressed_key 90else_jump @MISSION_2:MISSION_120247: request_model #BRAVURA0247: request_model #SWAT:Load_Model_Check0001: wait  0 ms00D6: if  00248:   model #BRAVURA available004D: jump_if_false @Load_Model_Check:Load_Model_Check_20001: wait  0 ms00D6: if  00248:   model #SWAT available004D: jump_if_false @Load_Model_Check_2:MISSION_2200A5: 0@ = create_car #BRAVURA at 3@ 4@ 5@ 04C4: store_coords_to 3@ 4@ 5@ from_actor $0[3] with_offset 0.0 8.0 0.0wait 500:MISSION_440129: 1@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseatwait 5000:MISSION_56020B: explode_car 0@0003: shake_camera 50:MISSION_68jump @MISSION_2   

 

 

Do I have to add a model check in my script?

Why doesn't it work?

 

0003: shake_camera 50

how to set how long the camera shakes, or does the 50 mean that?

Edited by Bad.boy!
Link to comment
Share on other sites

Use 0AB0 to check whether ASCII key is pressed or not.

Link to comment
Share on other sites

Not tested lol, edited current posted code.

 

 

 

0003: shake_camera 50

the 50 means the intensity of the camera shake.

 

The first script i'll state errors, second is the fixed version.

 

 

//-------------MAIN---------------thread 'MISSION':MISSION_2wait 0if 00E1:   player 0 pressed_key 90else_jump @MISSION_2 << I would never structure a key press like that, look below to find out how i'd do it---------------------------[i]:MISSION_2if80E1: not  player 0 pressed_key 90jf @Mission_12wait 0jump @mission_2[/i]--------------------------------:MISSION_120247: request_model #BRAVURA0247: request_model #SWATIts recommended but i never check if the model is available. -----------------------------------------------[/i]:Load_Model_Check0001: wait  0 ms00D6: if  00248:   model #BRAVURA available004D: jump_if_false @Load_Model_Check:Load_Model_Check_20001: wait  0 ms00D6: if  00248:   model #SWAT available004D: jump_if_false @Load_Model_Check_2------------------------------------------------You cannot create a car at a place that doesnt exist yet, Use the store opcode before using the create a car opcode.Also "from_actor $0[3] should be "from_actor $PLAYER_ACTOR" ---------------------------------------------------------------[i]:MISSION_2200A5: 0@ = create_car #BRAVURA at 3@ 4@ 5@ 04C4: store_coords_to 3@ 4@ 5@ from_actor $0[3] with_offset 0.0 8.0 0.0wait 500[/i]------------------------------------------:MISSION_440129: 1@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseatwait 5000:MISSION_56020B: explode_car 0@0003: shake_camera 50:MISSION_68jump @MISSION_2

 

 

Fixed code:

 

 

//-------------MAIN---------------thread 'MISSION':MISSION_2if80E1: not  player 0 pressed_key 90jf @mission_12wait 0jump @mission_2:MISSION_120247: request_model #BRAVURA0247: request_model #SWATwait 10:MISSION_2204C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 0.0 8.0 0.000A5: 0@ = create_car #BRAVURA at 3@ 4@ 5@wait 500:MISSION_440129: 1@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseatwait 5000:MISSION_56020B: explode_car 0@0003: shake_camera 50:MISSION_68wait 1000jump @MISSION_2

 

 

 

That code should work.

Link to comment
Share on other sites

I think cleo hates me.

I press z and nothing happens...

 

sanny builder compiled it to this:

 

//-------------MAIN---------------thread 'MISSION' :MISSION_11if 80E1:   not player 0 pressed_key 90 else_jump @MISSION_39 wait 0 jump @MISSION_11 :MISSION_39Model.Load(#BRAVURA)Model.Load(#SWAT)wait 10 04C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 0.0 8.0 0.0 0@ = Car.Create(#BRAVURA, 3@, 4@, 5@)wait 500 0129: 1@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseat wait 5000 020B: explode_car 0@ // versionA Camera.Shake(50)wait 1000 jump @MISSION_11 

 

Link to comment
Share on other sites

I just noticed something,

 

you wrote

 

jf @mission_12wait 0jump @mission_2

 

 

That means the script jumps to 12 if it is false and if it's good it jumps to 2, so it starts again

Or am I wrong here

Link to comment
Share on other sites

{$CLEO .cs}0000::MISSION_2wait 0if   player.Defined(0) jf @MISSION_2if    0AB0: VK_pressed 90jf @mission_2#BRAVURA.Load#SWAT.Load038B: load_requested_models04C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 0.0 8.0 0.000A5: 0@ = create_car #BRAVURA at 3@ 4@ 5@#BRAVURA.Destroywait 500if   car.Defined(0@)jf @unload0129: 1@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseat#SWAT.Destroywait 5000if   car.Defined(0@)jf @ret020B: explode_car 0@0003: shake_camera 50jump @ret:unload#SWAT.Destroy:retwait 1000jump @MISSION_2

 

Link to comment
Share on other sites

Lol damn, i forgot to add:

 

 

{$CLEO}0000:

 

 

Above "//------MAIN--------"

 

sorry.

Link to comment
Share on other sites

DK22Pac's script is working, but for some reason the camera doesn't shake, anyway thanks for all the replys biggrin.gif

Link to comment
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
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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