HeresOtis Posted May 12, 2011 Share Posted May 12, 2011 Everytime I press the key to start this it crashes. Whats wrong? // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread "FIREBAK" 0000: NOP Model.Load(#FIRELA)Model.Load(#FIRETRUK)Model.Load(#LAFD1)Model.Load(#FIRE_EX):FIREBAK_33wait 0 if Player.Defined($PLAYER_CHAR)else_jump @FIREBAK_33 wait 0 if 0AB0: key_pressed 97 else_jump @FIREBAK_33 jump @FIREBAK_79 :FIREBAK_79wait 0 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 -10.0 0.0 $PLAYERCAR = Actor.Car($PLAYER_ACTOR)0209: [email protected] = random_int_in_ranges 0 4 0871: init_jump_table [email protected] total_jumps 4 default_jump 0 @FIREBAK_192 jumps 0 @FIREBAK_199 1 @FIREBAK_226 2 @FIREBAK_253 3 @FIREBAK_280 -1 @FIREBAK_192 -1 @FIREBAK_192 -1 @FIREBAK_192 :FIREBAK_192jump @FIREBAK_307 :[email protected] += 50.0 [email protected] += 50.0 jump @FIREBAK_307 :[email protected] -= 50.0 [email protected] += 50.0 jump @FIREBAK_307 :[email protected] -= 50.0 [email protected] -= 50.0 jump @FIREBAK_307 :[email protected] += 50.0 [email protected] -= 50.0 jump @FIREBAK_307 :FIREBAK_307Model.Load(#FIRETRUK):FIREBAK_312wait 0 if Model.Available(#FIRETRUK)else_jump @FIREBAK_312 02C1: store_to [email protected] [email protected] [email protected] car_path_coords_closest_to [email protected] [email protected] [email protected] [email protected] = Car.Create(#FIRETRUK, [email protected], [email protected], [email protected])0129: $FIRE_DRIVER = create_actor_pedtype 18 model #LAFD1 in_car [email protected] driverseat 01C8: $FIRE_DRIVER_P = create_actor_pedtype 18 model #LAFD1 in_car [email protected] passenger_seat -1 01B2: give_actor $FIRE_DRIVER weapon 42 ammo 99999 // Load the weapon model before using this 01B2: give_actor $FIRE_DRIVER_P weapon 42 ammo 99999 // Load the weapon model before using this 055D: make_player $FIRE_DRIVER fireproof 1 055D: make_player $FIRE_DRIVER_P fireproof 1 07AF: $PLAYER_GROUP = player $PLAYER_ACTOR group 0631: put_actor $FIRE_DRIVER in_group $PLAYER_GROUP 0631: put_actor $FIRE_DRIVER_P in_group $PLAYER_GROUP 0397: enable_car [email protected] siren 1 07F8: car [email protected] follow_car $PLAYERCAR radius 13.5 [email protected] = Marker.CreateAboveCar([email protected])Marker.SetColor([email protected], 1)Car.SetMaxSpeed([email protected], 40.0)0423: set_car [email protected] improved_handling_to 2.0 // (float) 00AE: set_car [email protected] traffic_behaviour_to 3 067F: set_car [email protected] lights 2 jump @FIREBAK_535 :FIREBAK_535wait 0 if Actor.Driving($PLAYER_ACTOR)else_jump @FIREBAK_562 jump @FIREBAK_630 :FIREBAK_562wait 1000 0633: AS_actor $FIRE_DRIVER exit_car [email protected] = Marker.CreateAboveActor($FIRE_DRIVER)Marker.SetColor([email protected], 1)0633: AS_actor $FIRE_DRIVER_P exit_car [email protected] = Marker.CreateAboveActor($FIRE_DRIVER_P)Marker.SetColor([email protected], 1)0850: AS_actor $FIRE_DRIVER follow_actor $PLAYER_ACTOR 0850: AS_actor $FIRE_DRIVER_P follow_actor $PLAYER_ACTOR jump @FIREBAK_692 :FIREBAK_630wait 0 if 0973: fire -1 exists else_jump @FIREBAK_535 wait 0 06F5: create_coordinate [email protected] [email protected] [email protected] from_fire -1 wait 600 Car.DriveTo([email protected], [email protected], [email protected], [email protected])jump @FIREBAK_773 :FIREBAK_692wait 0 if 0973: fire -1 exists else_jump @FIREBAK_535 wait 0 06F5: create_coordinate [email protected] [email protected] [email protected] from_fire -1 wait 0 if 01AE: car $PLAYERCAR sphere 0 near_point [email protected] [email protected] radius 10.0 10.0 stopped else_jump @FIREBAK_692 jump @FIREBAK_773 :FIREBAK_773wait 500 0633: AS_actor $FIRE_DRIVER exit_car [email protected] = Marker.CreateAboveActor($FIRE_DRIVER)Marker.SetColor([email protected], 1)0633: AS_actor $FIRE_DRIVER_P exit_car [email protected] = Marker.CreateAboveActor($FIRE_DRIVER_P)Marker.SetColor([email protected], 1)wait 200 02D6: actor $FIRE_DRIVER fires_weapon 42 in_rectangle_cornerA [email protected] [email protected] cornerB [email protected] [email protected] 02D6: actor $FIRE_DRIVER_P fires_weapon 42 in_rectangle_cornerA [email protected] [email protected] cornerB [email protected] [email protected] jump @FIREBAK_868 :FIREBAK_868wait 0 if 02D0: fire -1 extinguished else_jump @FIREBAK_868 wait 2000 0850: AS_actor $FIRE_DRIVER follow_actor $PLAYER_ACTOR 0850: AS_actor $FIRE_DRIVER_P follow_actor $PLAYER_ACTOR jump @FIREBAK_915 :FIREBAK_915wait 0 if Actor.Dead($FIRE_DRIVER)else_jump @FIREBAK_535 wait 500 06C9: remove_actor $FIRE_DRIVER from_group Actor.RemoveReferences($FIRE_DRIVER)Marker.Disable([email protected])jump @FIREBAK_962 :FIREBAK_962wait 0 if Actor.Dead($FIRE_DRIVER_P)else_jump @FIREBAK_535 wait 500 06C9: remove_actor $FIRE_DRIVER_P from_group Actor.RemoveReferences($FIRE_DRIVER_P)Marker.Disable([email protected])jump @FIREBAK_1009 :FIREBAK_1009if and Actor.Dead($FIRE_DRIVER) Actor.Dead($FIRE_DRIVER_P)else_jump @FIREBAK_535 0632: release_group $PLAYER_GROUP jump @FIREBAK_1042 :FIREBAK_1042if Car.Destroy([email protected])else_jump @FIREBAK_535 wait 5000 jump @FIREBAK_33 Link to comment Share on other sites More sharing options...
OrionSR Posted May 12, 2011 Share Posted May 12, 2011 I stopped reading the script as soon as I saw that you were using your own global variable. You are asking for trouble when you make up your own global names. Link to comment Share on other sites More sharing options...
HeresOtis Posted May 12, 2011 Author Share Posted May 12, 2011 which one is made up? Link to comment Share on other sites More sharing options...
Adler Posted May 12, 2011 Share Posted May 12, 2011 $PLAYERCAR, $FIRE_DRIVER, $FIRE_DRIVER_P, etc. must be changed to local variables. Link to comment Share on other sites More sharing options...
HeresOtis Posted May 13, 2011 Author Share Posted May 13, 2011 I changed them all and the game still crashes when I press the key. I'm trying to make it where it spawns a firetruck with 2 firefighters in it with the fire extinguisher as a weapon and the car and peds follow me. Link to comment Share on other sites More sharing options...
Adler Posted May 13, 2011 Share Posted May 13, 2011 These could be a problem: 055D: make_player $FIRE_DRIVER fireproof 1055D: make_player $FIRE_DRIVER_P fireproof 1 They might only be applicable to the player. Try 02AB instead. Link to comment Share on other sites More sharing options...
OrionSR Posted May 13, 2011 Share Posted May 13, 2011 (edited) Crash: 07AF should use $PLAYER_CHAR not $PLAYER_ACTOR //07AF: $PLAYER_GROUP = player $PLAYER_ACTOR group 07AF: [email protected] = player $PLAYER_CHAR group This line is causing a crash. Edit: works when all undefined global variables were swapped out for local variables. //07F8: car [email protected] follow_car $PLAYERCAR radius 13.507F8: car [email protected] follow_car [email protected] radius 13.5 It would be a good idea to load all models used and to check to make sure they are loaded. :FIREBAK_307Model.Load(#FIRETRUK)Model.Load(#LAFD1)Model.Load(#FIRE_EX):FIREBAK_312wait 0if and Model.Available(#FIRETRUK) Model.Available(#LAFD1) Model.Load(#FIRE_EX) These lines did not cause a crash but they did not make the firefighters fireproof. Use the opcode suggested by Adler. //055D: make_player $FIRE_DRIVER fireproof 1//055D: make_player $FIRE_DRIVER_P fireproof 1055D: make_player [email protected] fireproof 1055D: make_player [email protected] fireproof 1 Edited May 13, 2011 by OrionSR Link to comment Share on other sites More sharing options...
spaceeinstein Posted May 13, 2011 Share Posted May 13, 2011 ^$PLAYER_CHAR Link to comment Share on other sites More sharing options...
OrionSR Posted May 13, 2011 Share Posted May 13, 2011 (edited) I think the global names get truncated at some point because $PLAYER_CHARACTER was working just fine, but yeah: $PLAYER_CHAR would provide better consistency. I'll edit my post accordingly. There are several versions of the opcode that records an actor's car. It would be best to use the opcode version just to be sure of what gets compiled. I'm not sure what the difference is. //$PLAYERCAR = Actor.Car($PLAYER_ACTOR)//00D9: [email protected] = actor $PLAYER_ACTOR car // mission only 03C0: [email protected] = actor $PLAYER_ACTOR car //0811: [email protected] = actor $PLAYER_ACTOR car // versionC When I was lazy and didn't change out all the undefined global variables for local variables I had unusual crashes. The general rule for using global variables is to only use $PLAYER_ACTOR, $PLAYER_CHAR, and $ONMISSION in your CLEO scripts. Local variables [email protected] and [email protected] are local timers. Their values constantly change. This is not the correct way to use them. //06F5: create_coordinate [email protected] [email protected] [email protected] from_fire -1 06F5: create_coordinate [email protected] [email protected] [email protected] from_fire -1 Edited May 13, 2011 by OrionSR Link to comment Share on other sites More sharing options...
spaceeinstein Posted May 13, 2011 Share Posted May 13, 2011 (edited) 03C0 works generally. Apparently Actor.Car uses 00D9. The others are specific to certain situations. 00D9, 0811 If you want to keep track of variables without using global variables, you can use constPLAYER_CAR = [email protected]: PLAYER_CAR = actor $PLAYER_ACTOR car0229: set_car PLAYER_CAR primary_color_to 0 secondary_color_to 0 Edited May 13, 2011 by spaceeinstein Link to comment Share on other sites More sharing options...
HeresOtis Posted May 13, 2011 Author Share Posted May 13, 2011 thanks everyone. I got the script functioning. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now