Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Reduce speed


Nesthor
 Share

Recommended Posts

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

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]

 

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
 Share

  • 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.