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. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    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

savidge

[SA] Is this possible with CLEO?

Recommended Posts

savidge

And here's my updated script, tested and working, for both the driver and passenger doors, independently. Still need to update your ini defintions.

 

 

{$CLEO}0000:const    DRIVER_DOOR             = 2    PASSGR_DOOR             = 3        DoorAudio1              = [email protected]    DoorAudio2              = [email protected]    Plyr_Veh                = [email protected]    fDoorAngle              = [email protected]    IsDriverDoorAlreadyOpen = [email protected]    IsPassgrDoorAlreadyOpen = [email protected]    DidPlayerSwitchVehicles = [email protected]    end // const0AC1: load_3d_audio_stream "CLEO/alarm.mp3" store_to DoorAudio10AC1: load_3d_audio_stream "CLEO/alarm.mp3" store_to DoorAudio2while true    wait 0    if        0256:   is_player_playing $PLAYER_CHAR    then        if            $ACTIVE_INTERIOR == 0        then            0A96: get_char_pointer $PLAYER_ACTOR store_to [email protected]            [email protected] += 0x58C // Last/current driven car            0A8D: read_memory [email protected] size 4 vp 0 store_to [email protected]            if                [email protected] > 0            then                    0AEB: get_vehicle_pointer_handle [email protected] store_to Plyr_Veh                if                    8119:   NOT is_car_dead Plyr_Veh                then                    IsDriverDoorAlreadyOpen = false                    IsPassgrDoorAlreadyOpen = false                    DidPlayerSwitchVehicles = false                                    while true                        wait 0                        if and                            0256:   is_player_playing $PLAYER_CHAR                            $ACTIVE_INTERIOR == 0                        then                            gosub @CheckIfDrivenVehicleSwitched                            if                                DidPlayerSwitchVehicles == true                            then                                break                            end                            if                                8119:   NOT is_car_dead Plyr_Veh                            then                                if                                    IsDriverDoorAlreadyOpen == false                                then                                    095F: get_door_angle_ratio Plyr_Veh door DRIVER_DOOR store_to fDoorAngle                                    0097: abs_lvar_float fDoorAngle                                    if                                        fDoorAngle > 0.0                                    then                                        0AC5: set_play_3d_audio_stream_at_car DoorAudio1 car Plyr_Veh                                        0AC0: set_audio_stream_looped DoorAudio1 to 1                                        0AAD: set_audio_stream_state DoorAudio1 to 1    // play                                        IsDriverDoorAlreadyOpen = true                                    end                                else                                    095F: get_door_angle_ratio Plyr_Veh door DRIVER_DOOR store_to fDoorAngle                                    0097: abs_lvar_float fDoorAngle                                    if                                        fDoorAngle == 0.0                                    then                                        0AAD: set_audio_stream_state DoorAudio1 to 0    // stop                                        IsDriverDoorAlreadyOpen = false                                    end                                end                                 if                                    IsPassgrDoorAlreadyOpen == false                                then                                    095F: get_door_angle_ratio Plyr_Veh door PASSGR_DOOR store_to fDoorAngle                                    0097: abs_lvar_float fDoorAngle                                    if                                        fDoorAngle > 0.0                                    then                                        0AC5: set_play_3d_audio_stream_at_car DoorAudio2 car Plyr_Veh                                        0AC0: set_audio_stream_looped DoorAudio2 to 1                                        0AAD: set_audio_stream_state DoorAudio2 to 1    // play                                        IsPassgrDoorAlreadyOpen = true                                    end                                else                                    095F: get_door_angle_ratio Plyr_Veh door PASSGR_DOOR store_to fDoorAngle                                    0097: abs_lvar_float fDoorAngle                                    if                                        fDoorAngle == 0.0                                    then                                        0AAD: set_audio_stream_state DoorAudio2 to 0    // stop                                        IsPassgrDoorAlreadyOpen = false                                    end                                end                                        else                                break                            end                        else                            break                        end                    end                    0AAD: set_audio_stream_state DoorAudio1 to 0    // stop                    0AAD: set_audio_stream_state DoorAudio2 to 0    // stop                    01C3: mark_car_as_no_longer_needed Plyr_Veh                end            end        end    endend                    :CheckIfDrivenVehicleSwitchedif    DidPlayerSwitchVehicles == falsethen    0A96: get_char_pointer $PLAYER_ACTOR store_to [email protected]    [email protected] += 0x58C // Last/current driven car    0A8D: read_memory [email protected] size 4 vp 0 store_to [email protected]    if        [email protected] > 0    then            0AEB: get_vehicle_pointer_handle [email protected] store_to [email protected]        if            8119:   NOT is_car_dead [email protected]        then            if                803B:   Plyr_Veh <> [email protected]            then                DidPlayerSwitchVehicles = true            end        end    endendreturn

 

 

Thank you as well, Otis! It works brilliantly! :)

Share this post


Link to post
Share on other sites
uokka

Weird thing, though... for me the left doors only work with

 

fDoorAngle < 0.0
while the right doors need (as expected)

 

fDoorAngle > 0.0
hmm..

Share this post


Link to post
Share on other sites
HeresOtis

Weird thing, though... for me the left doors only work with

fDoorAngle < 0.0
while the right doors need (as expected)

 

fDoorAngle > 0.0
hmm..

 

That's why I made the variables absolute.

0097: abs_lvar_float [email protected]

Share this post


Link to post
Share on other sites
uokka

Thats new to me. Is it only needed for constants?

The script I posted at first didn't need anything like that or any if statements negated.

Share this post


Link to post
Share on other sites
HeresOtis

 

[...], I wish there was a "Love this" button, hahaha.

I know that phrase.. (:

My pleasure. Have fun!

 

 

EDIT:

[...], for both the driver and passenger doors, independently. [...]

I really like the code layout you use so I edited yours instead of mine to include rear doors for four door vehicles and also I don't see a reason for multible beep sounds.

 

I just tried to replicate the script in the video. I think most cars in real life only put the beep on driver doors. But the code is open-source so whoever can edit to their preference.

Share this post


Link to post
Share on other sites
uokka

Ah, alright. I didn't even watched the video. I was just opensourcing around. q:

Share this post


Link to post
Share on other sites
savidge

How do I disable the beep for bicycles and motorbikes? Or better yet, how do I enable it for cars only?

Share this post


Link to post
Share on other sites
uokka

I wish I'd now about a better way rather than excluding non-cars.

 

Right below:

 

                0AEB: Player_Veh = get_vehicle_pointer_handle [email protected]                if                    8119:   NOT is_car_dead Player_Veh                then
Paste this:

 

                    0441: Player_Veh_Model = get_vehicle_model Player_Veh                    if or                        081E: model Player_Veh_Model boat                        081F: model Player_Veh_Model plane                        0820: model Player_Veh_Model heli                        Player_Veh_Model == #BIKE                        Player_Veh_Model == #BMX                        Player_Veh_Model == #MTBIKE                    then CONTINUE                    if or                        Player_Veh_Model == 448 // #PIZZABOY                        Player_Veh_Model == 461 // #pcj600                        Player_Veh_Model == 462 // #faggio                        Player_Veh_Model == 463 // #FREEWAY                        Player_Veh_Model == 468 // #sanchez                        Player_Veh_Model == 471 // #QUAD                    then CONTINUE                    if or                        Player_Veh_Model == 521 // #fcr900                        Player_Veh_Model == 522 // #nrg500                        Player_Veh_Model == 523 // #copbike                        Player_Veh_Model == 571 // #kart                        Player_Veh_Model == 581 // #bf400                        Player_Veh_Model == 586 // #wayfarer                    then CONTINUE
"Player_Veh_Model" needs to be included to the constants with a free variable assinged.

 

Untested.

Share this post


Link to post
Share on other sites
Silent

Good point, but I'm sure there as an opcode returning this :p

Share this post


Link to post
Share on other sites
HeresOtis

Good point, but I'm sure there as an opcode returning this :p

08EC: get_vehicle_class $TEMPVAR_ACTOR_CAR store_to $TEMPVAR_CAR_TYPE

Share this post


Link to post
Share on other sites
savidge
08EC: get_vehicle_class $TEMPVAR_ACTOR_CAR store_to $TEMPVAR_CAR_TYPE

sorry for asking so many questions, but where would I place that opcode if I'm using the script uokka posted?

Share this post


Link to post
Share on other sites
uokka

 

                0AEB: Player_Veh = get_vehicle_pointer_handle [email protected]                if                    8119:   NOT is_car_dead Player_Veh                then                // I'd say here:                //08EC: get_vehicle_class Player_Veh store_to [email protected]                08EC: [email protected] = car Player_Veh class                if or                    [email protected] == 0 // CAutomobile                    [email protected] == 1 // CMtruck                then                ..                ..                ..                end
E:

Above seems to be wrong, though.

http://gtag.gtagaming.com/opcode-database/opcode/08EC/

 

normal = 0poorfamily = 1richfamily = 2executive = 3worker = 4big = 5taxi = 6moped = 7motorbike = 8leisureboat = 9workerboat = 10bicycle = 11ignore = -1
E2:

 

                0AEB: Player_Veh = get_vehicle_pointer_handle [email protected]                if                    8119:   NOT is_car_dead Player_Veh                then                // I'd say here:                //08EC: get_vehicle_class Player_Veh store_to [email protected]                08EC: [email protected] = car Player_Veh class                if                    not [email protected] > 6                then                ..                ..                ..                end
Edited by uokka

Share this post


Link to post
Share on other sites
Silent

Still, the class should be obtainable via an opcode. I'll check it later.

Share this post


Link to post
Share on other sites
savidge

Thanks for helping me, guys. :)

EDIT: I just tried what uokka suggested but when I try to compile it it says "expected 1 params".

Edited by SergeantSavidge

Share this post


Link to post
Share on other sites
PremiumMods

Any complete release for this?

Share this post


Link to post
Share on other sites
uokka

Make sure you have a 1 second mp3 sound file at "CLEO\AUDIO\DOOR_BEEP.mp3". Or change file name and duration before compiling.

 

...    DoorAudioLength         = 1000...0AC1: DoorAudio = load_3d_audio_stream "CLEO\AUDIO\DOOR_BEEP.mp3"...

 

veh_door_beep.txt

 

{$CLEO}0000:const    DOOR_FL                 = 2    DOOR_FR                 = 3    DOOR_RL                 = 4    DOOR_RR                 = 5        Player_Veh              = [email protected]    Player_Veh_Model        = [email protected]    Player_Veh_Class        = [email protected]    DidPlayerSwitchVehicles = [email protected]    fDoorAngle              = [email protected]    IsAllDoorsClosed        = [email protected]    DoorAudio               = [email protected]    DoorAudioLength         = 1000    Timer                   = [email protected]    end // const0AC1: DoorAudio = load_3d_audio_stream "CLEO\AUDIO\DOOR_BEEP.mp3"WHILE TRUE    wait 0    if 0256:   is_player_playing $PLAYER_CHAR    then        if $ACTIVE_INTERIOR == 0        then            0A96: [email protected] = get_char_pointer $PLAYER_ACTOR            [email protected] += 0x58C // Last/current driven car            0A8D: [email protected] = read_memory [email protected] size 4 vp 0            if [email protected] > 0            then                0AEB: Player_Veh = get_vehicle_pointer_handle [email protected]                if 8119:   NOT is_car_dead Player_Veh                then                    if 0ABE:   vehicle Player_Veh engine_on                    JF CONTINUE                    0A97: Player_Veh_Class = car Player_Veh struct                    Player_Veh_Class += 0x594 // Sub-class transport                    0A8D: Player_Veh_Class = read_memory Player_Veh_Class size 4 vp 0                    if //or                        Player_Veh_Class == 0 // CAutomobile                        //Player_Veh_Class == 1 // CMtruck  // Monster trucks                    then                    {                    //08EC: get_vehicle_class $TEMPVAR_ACTOR_CAR store_to $TEMPVAR_CAR_TYPE                    08EC: Player_Veh_Class = car Player_Veh class                    if and                        Player_Veh_Class >= 0                        not Player_Veh_Class > 6                    then                    }                        DidPlayerSwitchVehicles = false                        WHILE TRUE                            wait 0                            if and                                0256:   is_player_playing $PLAYER_CHAR                                $ACTIVE_INTERIOR == 0                            then                                gosub @CheckIfDrivenVehicleSwitched                                if DidPlayerSwitchVehicles == true                                then BREAK                                end                                if 8119:   NOT is_car_dead Player_Veh                                then                                    if 0ABE:   vehicle Player_Veh engine_on                                    JF BREAK                                    gosub @CheckIfVehicleDoorsClosed                                    if IsAllDoorsClosed == false                                    then                                        if 0019: Timer > DoorAudioLength                                        JF CONTINUE                                        0AC5: set_play_3d_audio_stream_at_car DoorAudio car Player_Veh                                        //0ABC: set_audio_stream DoorAudio volume 0.8                                        0AAD: set_audio_stream_state DoorAudio to 1    // play                                        Timer = 0                                    else                                        0AAD: set_audio_stream_state DoorAudio to 0    // stop                                        Timer = DoorAudioLength                                    end                                else BREAK                                end                            else BREAK                            end                        END // WHILE                        0AAD: set_audio_stream_state DoorAudio to 0    // stop                        01C3: mark_car_as_no_longer_needed Player_Veh                    end                end            end        end    endEND // WHILE:CheckIfDrivenVehicleSwitchedif DidPlayerSwitchVehicles == falsethen    0A96: [email protected] = get_char_pointer $PLAYER_ACTOR    [email protected] += 0x58C // Last/current driven car    0A8D: [email protected] = read_memory [email protected] size 4 vp 0    if [email protected] > 0    then            0AEB: [email protected] = get_vehicle_pointer_handle [email protected]        if 8119:   NOT is_car_dead [email protected]        then            if 803B:   Player_Veh <> [email protected]            then DidPlayerSwitchVehicles = true            end        end    endendreturn:CheckIfVehicleDoorsClosed095F: get_door_angle_ratio Player_Veh door DOOR_FL store_to fDoorAngle // Front Leftif fDoorAngle < 0.0then IsAllDoorsClosed = falseelse    095F: get_door_angle_ratio Player_Veh door DOOR_FR store_to fDoorAngle // Front Right    if fDoorAngle > 0.0    then IsAllDoorsClosed = false    else        095F: get_door_angle_ratio Player_Veh door DOOR_RL store_to fDoorAngle // Rear Left        if fDoorAngle < 0.0        then IsAllDoorsClosed = false        else            095F: get_door_angle_ratio Player_Veh door DOOR_RR store_to fDoorAngle // Rear Right            if fDoorAngle > 0.0            then IsAllDoorsClosed = false            else                IsAllDoorsClosed = true            end        end    endendreturn

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.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.