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. Forum Support

    3. Suggestions

Problem with this script (easy i think)


Diegoti
 Share

Recommended Posts

This script is supposed to create 4 units in front of you in a range of 150 meters, but rarely it sometimes have problem when creating them, someones just are create at the same place, other spawns bugged underground (only when im near hills or mountains) and others spawns just 10 meters in front of me also they dont spawns all the same time or takes some secs to spawns (which hasnt sense)

 

{$CLEO .cs}

//-------------MAIN---------------
thread '4chase' 



while true
wait 0
    if Player.WantedLevel($PLAYER_CHAR) > 0          
    then
        if 856E:   car [email protected] defined
        then
            gosub @Create 
        end       
    end
    
//  s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   
    
    if or
        80FE:   actor $PLAYER_ACTOR sphere 0 in_sphere [email protected] [email protected] [email protected] radius 200.0 200.0 200.0  
        not Player.WantedLevel($PLAYER_CHAR) > 0
    then
        gosub @Delete
        if Player.WantedLevel($PLAYER_CHAR) > 0    
        then         
            if 856E:   car [email protected] defined
            then
                gosub @Create
            end 
        end 
    end
    

    
end

:Create
00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]

if 056E:   car [email protected] defined
then 
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.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
end
//-------------------------------------- 

    if Player.WantedLevel($PLAYER_CHAR) > 0
    then
        [email protected]=#COPCARRU
        [email protected]=#FBI
        [email protected]=#COLT45 
        [email protected] = 22   
        [email protected] = 0.1 
        [email protected] = 0.1 
        [email protected] = 1       
    end     
    if Player.WantedLevel($PLAYER_CHAR) > 1//3
    then
        [email protected]=#HUNTLEY
        [email protected]=#SWAT
        [email protected]=#MP5LNG 
        [email protected] = 29   
        [email protected] = -1.5 
        [email protected] = 0.1 
        [email protected] = 2        
    end    
    if Player.WantedLevel($PLAYER_CHAR) > 2//5
    then
        [email protected]=#SECURICA
        [email protected]=#ARMY
        [email protected]=#M4 
        [email protected] = 31   
        [email protected] = -1.0 
        [email protected] = 1.5 
        [email protected] = 3              
    end

Model.Load([email protected])
Model.Load([email protected])
Model.Load([email protected])
038B: load_requested_models 

////-------------------------------------------------


if and
    Model.Available([email protected])
    Model.Available([email protected])
    Model.Available([email protected])
then
0ACD: show_text_highpriority "2" time 1000


//------------------------------------------------------------- 
//Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 50.0 150.0 0.0
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected] 
02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] 
[email protected] = Car.Create([email protected], [email protected], [email protected], [email protected]) //# # # # # # # # # # # 
02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1
0208: [email protected] = random_float_in_ranges 0.0 360.0   
Car.Angle([email protected]) = [email protected]                                                                                                                           
[email protected] = Actor.Create(Cop, [email protected], [email protected], [email protected], [email protected]) //A A A A A A A A A   
0619: enable_actor [email protected] collision_detection 0                                                                                             
0464: put_actor [email protected] into_turret_on_car [email protected] at_car_offset 0.0 [email protected] [email protected] position 0 shooting_angle_limit 360.0 with_weapon [email protected]
0638: AS_actor [email protected] stay_put 1                                          
Actor.WeaponAccuracy([email protected]) = 90   
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR
//------------------------------------------------------------- 
//  
//------------------------------------------------------------- 
//Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -50.0 150.0 0.0
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected]   
02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] 
[email protected] = Car.Create([email protected], [email protected], [email protected], [email protected]) //# # # # # # # # # # # 
02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1
0208: [email protected] = random_float_in_ranges 0.0 360.0   
Car.Angle([email protected]) = [email protected]                                                                                                                           
[email protected] = Actor.Create(Cop, [email protected], [email protected], [email protected], [email protected]) //A A A A A A A A A   
0619: enable_actor [email protected] collision_detection 0                                                                                              
0464: put_actor [email protected] into_turret_on_car [email protected] at_car_offset 0.0 0.0 1.5 position 0 shooting_angle_limit 360.0 with_weapon [email protected]
0638: AS_actor [email protected] stay_put 1                                          
Actor.WeaponAccuracy([email protected]) = 90   
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR
//------------------------------------------------------------- 
// 
//------------------------------------------------------------- 
//Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 50.0 170.0 0.0
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected] 
02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] 
[email protected] = Car.Create([email protected], [email protected], [email protected], [email protected]) //# # # # # # # # # # # 
02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1
0208: [email protected] = random_float_in_ranges 0.0 360.0   
Car.Angle([email protected]) = [email protected]                                                                                                                           
[email protected] = Actor.Create(Cop, [email protected], [email protected], [email protected], [email protected]) //A A A A A A A A A   
0619: enable_actor [email protected] collision_detection 0                                                                                              
0464: put_actor [email protected] into_turret_on_car [email protected] at_car_offset 0.0 0.0 1.5 position 0 shooting_angle_limit 360.0 with_weapon [email protected]
0638: AS_actor [email protected] stay_put 1                                          
Actor.WeaponAccuracy([email protected]) = 90   
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR
//------------------------------------------------------------- 
// 
//------------------------------------------------------------- 
//Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -50.0 170.0 0.0
04D3: get_nearest_car_path_coords_from [email protected] [email protected] [email protected] type 2 store_to [email protected] [email protected] [email protected]  
02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] 
[email protected] = Car.Create([email protected], [email protected], [email protected], [email protected]) //# # # # # # # # # # # 
02AC: set_car [email protected] immunities BP 1 FP 0 EP 0 CP 1 MP 1
0208: [email protected] = random_float_in_ranges 0.0 360.0   
Car.Angle([email protected]) = [email protected]                                                                                                                           
[email protected] = Actor.Create(Cop, [email protected], [email protected], [email protected], [email protected]) //A A A A A A A A A   
0619: enable_actor [email protected] collision_detection 0                                                                                              
0464: put_actor [email protected] into_turret_on_car [email protected] at_car_offset 0.0 0.0 1.5 position 0 shooting_angle_limit 360.0 with_weapon [email protected]
0638: AS_actor [email protected] stay_put 1                                          
Actor.WeaponAccuracy([email protected]) = 90   
05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR
//------------------------------------------------------------- 
// 

if [email protected] == 1
then       
0229: set_car [email protected] primary_color_to 0 secondary_color_to 1 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 1 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 1 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 1                           
end  
if [email protected] == 2
then       
0229: set_car [email protected] primary_color_to 0 secondary_color_to 0 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 0 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 0 
0229: set_car [email protected] primary_color_to 0 secondary_color_to 0                           
end 
if [email protected] == 3
then       
0229: set_car [email protected] primary_color_to 48 secondary_color_to 72 
0229: set_car [email protected] primary_color_to 48 secondary_color_to 72 
0229: set_car [email protected] primary_color_to 48 secondary_color_to 72 
0229: set_car [email protected] primary_color_to 48 secondary_color_to 72                           
end

020A: lock_car_doors [email protected] mode 4 
020A: lock_car_doors [email protected] mode 4 
020A: lock_car_doors [email protected] mode 4 
020A: lock_car_doors [email protected] mode 4 

Actor.Health([email protected]) = 1000 
Actor.Health([email protected]) = 1000 
Actor.Health([email protected]) = 1000 
Actor.Health([email protected]) = 1000  

end

wait 1
return

:Delete
if 056E:   car [email protected] defined
then
Car.Destroy([email protected])
Car.Destroy([email protected])
Car.Destroy([email protected])
Car.Destroy([email protected])
Actor.DestroyInstantly([email protected])
Actor.DestroyInstantly([email protected])
Actor.DestroyInstantly([email protected])
Actor.DestroyInstantly([email protected])     
Car.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
Car.RemoveReferences([email protected])
end
//[email protected] = 1
wait 1
return


///////-

 

Link to comment
Share on other sites

the spawned cars can stuck in the street
if street goes up or down by 20.0 degree then car will stuck in street
test it by spawning higher and also in a closer range, if they appear better

04C4: store_coords_to 10@ 11@ 12@ from_actor $PLAYER_ACTOR with_offset 50.0 50.0 0.0
04D3: get_nearest_car_path_coords_from 10@ 11@ 12@ type 2 store_to 13@ 14@ 15@
//02CE: 16@ = ground_z_at 13@ 14@ 15@
15@ += 10.0
1@ = Car.Create(25@, 13@, 14@, 15@)

 

Edited by ZAZ
Link to comment
Share on other sites

Well, it works but the main problem is that those units take some seconds to spawn, idk why does this happens.

Link to comment
Share on other sites

40 m is enough right now
do not give 170 m
and on the third offset give -1.0 then car when creating on streets
and it's best to study the distance from the earth with this opcode
0819: 162 @ = actor $ PLAYER_ACTOR distance_from_ground
and the cars in gta san andreas have f*cked up intelligences
they fall into ditches they fall over and much more
add this opcodes
072F: enable_car 6 @ stuck_check_distance 0.5 time 4000 and_restore_if stuck 1 flipped 1 unk_place_on_road_properly 1 to_path 7 // extended 03CC
     0587: enable_car 6 @ validate_position 0       

 

Link to comment
Share on other sites

Yup, but it still having problems when spawning, somethings when im driving a mid/high speed, they just appear in front of my of over me.

Link to comment
Share on other sites

totally useless what kind of idea is this without driver no chasing and no shooting stay idle in turret mod at least make it chasing player with driver and if you want to find out what is the problem make it simple make it one car with driver in it and one soldier and see if it works then add one by one 

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.