ThreeAmigosModding / TAM_BetterRadioAnims

Improved radio anims with support for rp-emotes and scully emotes
GNU General Public License v3.0
24 stars 11 forks source link

Add Default animation for civs #3

Closed bluelineparabellum closed 7 months ago

bluelineparabellum commented 7 months ago
function RadioAnimation(equip)
    ClearPedTasks(PlayerPedId())

    for k, v in pairs(GetGamePool('CObject')) do
        if IsEntityAttachedToEntity(PlayerPedId(), v) then
            DeleteObject(v)
            DetachEntity(v, 0, 0)
            SetEntityAsMissionEntity(v, true, true)
            Wait(100)
            DeleteEntity(v)
        end
    end

    LoadAnimDict("cellphone@")

    if equip then
        TaskPlayAnim(PlayerPedId(), "cellphone@", "cellphone_text_read_base", 3.0, -3.0, -1, 49, 0, 0, 0, 0)
        local model = "prop_cs_hand_radio"
        RequestModel(GetHashKey(model))
        while not HasModelLoaded(GetHashKey(model)) do
            Wait(500)
        end
        radioProp = CreateObject(GetHashKey(model), 1.0, 1.0, 1.0, 1, 1, 0)
        AttachEntityToEntity(radioProp, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.14, 0.01, -0.02, 110.0, 120.0, -15.0, 1, 0, 0, 0, 2, 1)
    else
        StopAnimTask(PlayerPedId(), "cellphone@", "cellphone_text_read_base", 3.0)
        ClearPedTasks(PlayerPedId())
        if radioProp and DoesEntityExist(radioProp) then
            DeleteObject(radioProp)
            radioProp = nil
        end
    end
end
Hakkodevelopment commented 7 months ago

PMA comes with a default animation for civilian radios, i see no point in adding this.

bluelineparabellum commented 7 months ago

PMA comes with a default animation for civilian radios, i see no point in adding this.

You have to disable radio animation to use this script. Which defaults to player crouching to use the radio.

We would prefer using codestudios default animation.

Hakkodevelopment commented 7 months ago

Don't use RP emotes then lol.

I'll release an update soon (hopefully) which will fix this and add functionality