Hydromass Posted August 31, 2021 Share Posted August 31, 2021 Guys im trying to do something like this. Store [email protected] near vehicle with model #PATRIOT Then Set [email protected] random numbet between 1 20 If [email protected] == 1 Then Make [email protected] bullet proof If not [email protected] == 1 Then Make [email protected] non bullet proof ------- Store [email protected] near vehicle with model #ENFO Then Set [email protected] random numbet between 1 5 If [email protected] == 1 Then Make [email protected] bullet proof If not [email protected] == 1 Then Make [email protected] non bullet proof But i want this process repeats every second with all vehicles even if they where stored already Please help, as i dont know how to increase vehicles health (with cleo) im just trying to give them random temporal B/F/E/C/M proof (for military/police vehicles only) Link to comment Share on other sites More sharing options...
ZAZ Posted August 31, 2021 Share Posted August 31, 2021 It's difficult to get more different cars in traffic Test the script below, a blue marker above car shows which car was found and was mady very heavy and got 20000 health {$CLEO .cs} thread 'RANDCAR' 0@ = -1 while true wait 0 if 0256: player $PLAYER_CHAR defined then 077E: get_active_interior_to 31@ if //and 31@ == 0 //0AB0: key_pressed 8// backspace then 30@ = 0 29@ = 0 5@(29@,7i) = -1 for 4@ = 0 to 50 wait 0 gosub @RANDCAR_Car_Search if 30@ > 9 then break end end wait 500 for 30@ = 0 to 9 wait 0 if 8039: NOT 5@(30@,7i) == -1 then 0164: disable_marker 15@(30@,7i) end 5@(30@,7i) = -1 end end end end :RANDCAR_Car_Search 04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0 if 0AE2: 0@ = random_vehicle_near_point 1@ 2@ 3@ in_radius 70.0 find_next 0 pass_wrecked 0 //IF and SET then if 8039: NOT 0@ == -1 then if 8119: not car 0@ wrecked then if and 80DB: actor $PLAYER_ACTOR in_car 0@ 803B: not 0@ == 5@(29@,7i) then 0085: 5@(30@,7i) = 0@ // (int) 0186: 15@(30@,7i) = create_marker_above_car 5@(30@,7i) 07E0: set_marker 15@(30@,7i) type_to 1 01EC: make_car 5@(30@,7i) very_heavy 1 0224: set_car 5@(30@,7i) health_to 20000 0085: 29@ = 30@ 30@ += 1 end end end end //wait 50 return CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Hydromass Posted August 31, 2021 Author Share Posted August 31, 2021 (edited) The problem is that i want to "get" the same cars again. GIF HERE Spoiler I was trying this one {$CLEO .cs} {$CLEO} 0000: //[email protected] = 0 WHILE 8256: NOT player $PLAYER_CHAR defined wait 250 END WHILE TRUE wait 0 00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected] IF 0AE2: [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 1000.0 find_next 0 pass_wrecked 1 THEN REPEAT if 056E: car [email protected] defined then if 8118: actor $PLAYER_ACTOR dead then //---------------------- IF or 0137: car [email protected] model == #PATRIOT 0137: car [email protected] model == #ENFORCER THEN gosub @Inmus END //---------------------- end end UNTIL 8AE2: NOT [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 0.1 find_next 1 pass_wrecked 1 END END :Inmus [email protected] = 1 ///////---------------------------------------------------------- if 056E: car [email protected] defined then if 8119: car [email protected] wrecked then ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- if 056E: car [email protected] defined then if 0137: car [email protected] model == #PATRIOT then 0209: [email protected] = random_int_in_ranges 1 10 if [email protected] == 1 then 02AC: set_car [email protected] immunities BP 0 FP 0 EP 0 CP 0 MP 0 0ACD: show_text_highpriority "Lost" time 400 end if not [email protected] == 1 then 02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1 //0ACD: show_text_highpriority "Enabled" time 400 end end end wait 0 ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- if 056E: car [email protected] defined then if 0137: car [email protected] model == #BARRACKS then 02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1 end end wait 0 ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- ////---------------------------------------------------------- if 056E: car [email protected] defined then if 0137: car [email protected] model == #ENFORCER then //02AC: set_car [email protected] immunities BP 0 FP 0 EP 0 CP 1 MP 1 0209: [email protected] = random_int_in_ranges 1 10 if [email protected] == 1 then 02AC: set_car [email protected] immunities BP 0 FP 0 EP 0 CP 0 MP 0 0ACD: show_text_highpriority "Lost" time 400 end if not [email protected] == 1 then 02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1 0ACD: show_text_highpriority "Enabled" time 400 end //06A3: get_car [email protected] mass_to 1000 end end 0085: [email protected] = [email protected] // (int) [email protected] = 0 //Car.RemoveReferences([email protected]) end end wait 500 /////---------------------------------------------------------- return But it is not taking Enforcers and its also crashing my game after i die Edited August 31, 2021 by Hydromass Link to comment Share on other sites More sharing options...
ZAZ Posted September 1, 2021 Share Posted September 1, 2021 (edited) you first check if player_char is defined WHILE 8256: NOT player $PLAYER_CHAR defined wait 250 END and then you let the code permanently running in a while loop WITHOUT checking if player_char is defined WHILE TRUE wait 0 00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected] IF 0AE2: [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 1000.0 find_next 0 pass_wrecked 1 THEN REPEAT if 056E: car [email protected] defined then if 8118: actor $PLAYER_ACTOR dead then //---------------------- IF or 0137: car [email protected] model == #PATRIOT 0137: car [email protected] model == #ENFORCER THEN gosub @Inmus END //---------------------- end end UNTIL 8AE2: NOT [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 0.1 find_next 1 pass_wrecked 1 END END that's bullsh*t please read the comment of goodidea83 and read high level tut you may have this code in the loop if 8118: actor $PLAYER_ACTOR dead but it doesn't protect against this code 00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@ it also doesn't protect if player get arrested In Addition, the REPEAT-UNTIL loop needs a wait 0 this could be the reason for the crash Furthermore, you should try this code that have a parameter to insert model id 053E: 7@ = get_random_car_with_model #PACKER in_rectangle_cornerA 1@ 2@ cornerB 4@ 5@ Somebody wrote a script to attach cars on the packer which worked really good but in practice, you're standing infront of the packer, when get_car code should be executed in this case the random_car_search works fine the bigger the range of the search, the more badly it works also, the search engine ofter find the same car again instead these which we want Edited September 1, 2021 by ZAZ CLEO MODS CLEO Script Tutorial 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