Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Diegoti

GTA SA Car Collision Detector

Recommended Posts

Diegoti

Hello i was doing a Car car crash detector mod but it have a problem, doesnt detect Bikes crashes cuz when u crash with a motor u inmediately leave it n the mod doesnt work correctly when it happes

 

IF U CAN SUGGEST A BETTER WAY TO DO A "CAR COLLISION DETECTOR" PLS LET ME KNOW

Im trying to do my GTA more realistic with things like Car gasoline, Car stealing now harder/ Car shops, Car crash damage

 

{$CLEO .cs}

//-------------MAIN---------------
thread 'Script'

////

while true
    wait 1
    
        if Actor.Driving($PLAYER_ACTOR)
        then
            [email protected] = Actor.CurrentCar($PLAYER_ACTOR)
            02E3: [email protected] = car [email protected] speed  
            gosub @Timer
            gosub @Check
        end 
        if not Actor.Driving($PLAYER_ACTOR)
        then
            [email protected]= 0
            [email protected]= 0
            [email protected]= 0
        end

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////// LAUNCH    

end

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

:Check 

    if 8021:   [email protected] > 20.0 // (NOT)
    then  
    
        [email protected] = 1
        
    if 0019:   [email protected] > 0
    then        
        
        if [email protected] == 0 
        then
        
        if [email protected] == 1
        then
            0ACC: show_text_lowpriority "COLLISION ~y~TYPE 1" time 1000  
            [email protected]= 0      
        end 
        if [email protected] == 2
        then
            0ACC: show_text_lowpriority "~y~COLLISION ~r~TYPE 2" time 1000
            [email protected]= 0        
        end
        if [email protected] == 3
        then
            0ACC: show_text_lowpriority "~r~COLLISION TYPE 3" time 1000  
            [email protected]= 0      
        end
        if [email protected] == 4
        then
            0ACC: show_text_lowpriority "~r~COLLISION ~y~TYPE 4" time 1000
            [email protected]= 0        
        end
        
        end
        
        //-------------------------------------        
        
        if [email protected] == 1 
        then
        
        if [email protected] == 1
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000 
            [email protected]= 0 
            [email protected]= 0    
        end 
        if [email protected] == 2
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000 
            [email protected]= 0 
            [email protected]= 0     
        end 
        
        end
        //-------------------------------------        
        
        if [email protected] == 2 
        then
        
        if [email protected] == 1
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000 
            [email protected]= 0
            [email protected]= 0      
        end 
        if [email protected] == 2
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000 
            [email protected]= 0    
            [email protected]= 0  
        end
        if [email protected] == 3
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000  
            [email protected]= 0   
            [email protected]= 0  
        end
        if [email protected] == 4
        then
            0ACD: show_text_highpriority "~g~COLLISION IGNORED" time 1000 
            [email protected]= 0  
            [email protected]= 0     
        end
        
        end
    
        
        
        //-----------------------------------
        
        if Actor.Driving($PLAYER_ACTOR)
        then
        0226: [email protected] = actor $PLAYER_ACTOR health        
        0062: [email protected] -= [email protected]  // (int)
        0223: set_actor $PLAYER_ACTOR health_to [email protected]                
        0226: [email protected] = actor $PLAYER_ACTOR health  
        015B: shake_player_controller 0 time 3000 intensity 255 // ( THIS DOESNT WORK )
        end
        
        //------------------------------------
        
        if [email protected] == 4
        then
            020B: explode_car [email protected]
        end
        
        [email protected]= 0 
                    
    end 
    
        [email protected] = 0
    end  


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

if not [email protected] == 1
then
  
  
  
  
if 8021:   [email protected] > 30.0 // (NOT)
then
[email protected]= 0
end 

if 0021:   [email protected] > 30.0   // 11111111111111
then
[email protected]= 1
0209: [email protected] = random_int_in_ranges 10 30
end 
if 0021:   [email protected] > 40.0   // 2222222222222222222
then
[email protected]= 2
0209: [email protected] = random_int_in_ranges 60 30
end   
if 0021:   [email protected] > 45.0   // 333333333333333
then
[email protected]= 3
0209: [email protected] = random_int_in_ranges 90 200
end                   
if 0021:   [email protected] > 50.0  // 444444444444444
then
[email protected]= 4
[email protected]= 10000
end 

wait 200
return


:Timer


if and
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#FBIRANCH )
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#FBITRUCK )
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#RHINO )
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#PATRIOT ) 
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#BARRACKS )  
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#SECURICA ) 
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARSF )
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARVG )
then
    [email protected]= 0
end 
if and
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARLA )
    not Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARRU )
then
    [email protected]= 0
end

///////////////////////////////

if or
    Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARLA )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARRU )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARSF )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#COPCARVG )
then
    [email protected]= 1 
end 

if or
    Actor.DrivingVehicleType($PLAYER_ACTOR,#FBIRANCH )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#FBITRUCK )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#RHINO )
    Actor.DrivingVehicleType($PLAYER_ACTOR,#PATRIOT ) 
    Actor.DrivingVehicleType($PLAYER_ACTOR,#BARRACKS )  
    Actor.DrivingVehicleType($PLAYER_ACTOR,#SECURICA )
then
    [email protected]= 2
end

//////////////////////////////


wait 500
return

 

Share this post


Link to post
Share on other sites
Jack
3 hours ago, Diegoti said:

 

scm:

if 0449:   actor $PLAYER_ACTOR in_a_car
then
    03C0: [email protected] = actor $PLAYER_ACTOR car
    if 09CB:   vehicle [email protected] colliding_with_vehicle [email protected]    //  [email protected] = any vehicle
    then
        //    vehicle collision detected
    end
end

 

c++:

for (int i = 0; i < CPools::ms_pVehiclePool->m_nSize; i++) {
    auto veh = CPools::ms_pVehiclePool->GetAt(i);
    CPed *playa = FindPlayerPed();
    if (veh && playa->m_pVehicle) {
        if (veh->GetHasCollidedWith(playa->m_pVehicle)) {
            //    vehicle collision detected
        }
    }
}

 

Also you can use this opcode:

056C:   actor $PLAYER_ACTOR driving_police_car

if you want to check if the actor is inside any police vehicle model. 

Edited by Jack
.

Share this post


Link to post
Share on other sites
Diegoti
17 hours ago, Jack said:

scm:

if 0449:   actor $PLAYER_ACTOR in_a_car
then
    03C0: [email protected] = actor $PLAYER_ACTOR car
    if 09CB:   vehicle [email protected] colliding_with_vehicle [email protected]    //  [email protected] = any vehicle
    then
        //    vehicle collision detected
    end
end

 

c++:

for (int i = 0; i < CPools::ms_pVehiclePool->m_nSize; i++) {
    auto veh = CPools::ms_pVehiclePool->GetAt(i);
    CPed *playa = FindPlayerPed();
    if (veh && playa->m_pVehicle) {
        if (veh->GetHasCollidedWith(playa->m_pVehicle)) {
            //    vehicle collision detected
        }
    }
}

 

Also you can use this opcode:

056C:   actor $PLAYER_ACTOR driving_police_car

if you want to check if the actor is inside any police vehicle model. 

 

1st one: It will not detect enviroment collisions

2nd one; I dont know +cc so that r hieroglyphs to me :(

3rd one: I cant use it cuz on my mod FBI rancher r immune to high level collisions but standard cop-cars doesnt but cant resist mid level collisions

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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