Nesthor Posted February 26, 2019 Share Posted February 26, 2019 This script is very simple, just create a PEDs in x points, but I would like to know how I can make all vehicles that approach that point lower their speed, that area is on a track and sometimes cars pass very fast and if the player stops the PEDs what They hit back as they come very fast. Is there a opcode to help me limit the speed within that sphere {$CLEO .cs} thread "Wedght_Control_Point" :START wait 0 if and Player.Defined($PLAYER_CHAR) 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere -893.0284 2748.1965 46.4537 radius 200.0 200.0 200.0 jf @START jump @LOAD :LOAD wait 0 Model.Load(#CSHER) Model.Load(#BMYAP) 04ED: load_animation "COP_AMBIENT" 04ED: load_animation "POLICE" 04ED: load_animation "OTB" 038B: load_requested_models jump @REQUEST :REQUEST wait 0 if and Model.Available(#WMYMECH) model.Available(#CSHER) Model.available(#BMYAP) 04EE: animation "OTB" loaded 04EE: animation "COP_AMBIENT" loaded 04EE: animation "POLICE" loaded jump @CREATE :CREATE wait 0 [email protected] = Actor.Create(CivMale, #BMYAP, -931.27, 2738.9819, 47.0823) Actor.Angle([email protected]) = 171.71 [email protected] = Actor.Create(CivMale, #CSHER, -802.9181, 2736.7561, 45.3781) Actor.Angle([email protected]) = 268.95 [email protected] = Actor.Create(CivMale, #CSHER, -875.5771, 2733.0999, 45.8455) Actor.Angle([email protected]) = 268.95 [email protected] = Actor.Create(CivMale, #CSHER, -926.9132, 2741.1208, 46.212) Actor.Angle([email protected]) = 171.71 014B: $CAR6 = init_parked_car_generator #COPCARRU color -1 -1 1 alarm 0 door_lock 0 0 10000 at -803.9432 2743.0366 45.9622 angle 182.081 014C: set_parked_car_generator $CAR6 cars_to_generate_to 101 014B: $CAR7 = init_parked_car_generator #COPCARRU color -1 -1 1 alarm 0 door_lock 0 0 10000 at -893.0284 2748.1965 46.4537 angle 191.0699 014C: set_parked_car_generator $CAR7 cars_to_generate_to 101 014B: $CAR8 = init_parked_car_generator #YANKEE color -1 -1 1 alarm 0 door_lock 0 0 10000 at -923.035 2765.0532 46.6046 angle 9.6253 014C: set_parked_car_generator $CAR8 cars_to_generate_to 101 014B: $CAR9 = init_parked_car_generator #BUS color -1 -1 1 alarm 0 door_lock 0 0 10000 at -926.9672 2764.6543 46.605 angle 8.0976 014C: set_parked_car_generator $CAR9 cars_to_generate_to 101 014B: $CAR10 = init_parked_car_generator #ARTICT1 color -1 -1 1 alarm 0 door_lock 0 0 10000 at -927.382 2745.2639 46.4588 angle 94.9271 014C: set_parked_car_generator $CAR10 cars_to_generate_to 101 014B: $CAR11 = init_parked_car_generator #ARTICT3 color -1 -1 1 alarm 0 door_lock 0 0 10000 at -927.382 2745.2639 46.4588 angle 94.9271 014C: set_parked_car_generator $CAR11 cars_to_generate_to 101 014B: $CAR12 = init_parked_car_generator #RNCHLURE color -1 -1 1 alarm 0 door_lock 0 0 10000 at -948.1071 2749.9978 46.4052 angle 277.249 014C: set_parked_car_generator $CAR12 cars_to_generate_to 101 0812: AS_actor [email protected] perform_animation "WTCHRACE_LOOP" IFP "OTB" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1 // versionB 0812: AS_actor [email protected] perform_animation "COPTRAF_STOP" IFP "POLICE" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1 // versionB 0812: AS_actor [email protected] perform_animation "COPLOOK_LOOP" IFP "COP_AMBIENT" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1 // versionB 0812: AS_actor [email protected] perform_animation "COPLOOK_LOOP" IFP "COP_AMBIENT" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1 // versionB jump @END :END wait 600 80FE: not actor $PLAYER_ACTOR sphere 0 in_sphere -893.0284 2748.1965 46.4537 radius 200.0 200.0 200.0 if Actor.Dead([email protected]) jf @END jump @CLEAR :CLEAR wait 0 Actor.DestroyInstantly([email protected]) Actor.DestroyInstantly([email protected]) Actor.DestroyInstantly([email protected]) Actor.DestroyInstantly([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) CAR.Destroy([email protected]) wait 80000 jump @START Link to comment Share on other sites More sharing options...
In45do Posted February 27, 2019 Share Posted February 27, 2019 There's some error in the script : - Add " jf " at :Request thread - Never use global variable inside cleo script, I'm talking about :Create thread, also try to match car variables from that thread with :Clear thread - Put " if " check above the first condition at :End thread, use " if and " in this case because there is more than one condition 3 hours ago, Nesthor said: how I can make all vehicles that approach that point... To get all vehicles around that point: 0AE2: [email protected] = random_vehicle_near_point -893.0284 2748.1965 46.4537 in_radius 30.0 find_next 1 pass_wrecked 1 3 hours ago, Nesthor said: make all vehicles .... lower their speed Easiest method is simply set the max limit into the lowest speed: 00AD: set_car [email protected] max_speed_to 5.0 Or if that doesn't work, we use distance: :Loop wait 0 00AA: store_car [email protected] position_to [email protected] [email protected] [email protected] 050A: [email protected] = distance_between_XYZ -893.0284 2748.1965 46.4537 and_XYZ [email protected] [email protected] [email protected] if 20.0 > [email protected] // car under radius 20.0 jf @Loop [email protected] *= 0.7 // reducing car speed 04BA: set_car [email protected] speed_to [email protected] Nesthor 1 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