Skip to content

Voice Script Adaptation

To provide support, you will need to provide voice communication and to do this you will need to adapt it to your own voice script. We have adapted the pma-voice script inside the script. But if you have a different script, you will need to follow these steps.

Step 1

Seen on the config.lua file

Config.CreateCall = function(VoiceCall)

    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
    -- We are not responsible for the audio connections,
    -- you need to adapt it to your own audio, radio scripts,
    -- we only left an example for pma voice.
    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
    exports["pma-voice"]:setRadioChannel(VoiceCall.id)


    if Config.CallFromServerSide == true then 
        TriggerServerEvent("s4-report:redirectToServer:call", VoiceCall)
    end
    -- exports.saltychat:SetRadioChannel(1111, true)

    -- local playerName = GetPlayerName(PlayerId())
    -- local getPlayerRadioChannel = exports.tokovoip_script:getPlayerData(playerName, "radio:channel")
    -- exports.tokovoip_script:removePlayerFromRadio(getPlayerRadioChannel)
    -- exports.tokovoip_script:setPlayerData(playerName, "radio:channel", 1111, true);
    -- exports.tokovoip_script:addPlayerToRadio(1111)
end

In this section you will need to add your own script's trigger or export!

If your voice script uses a server side trigger or export, this is the part you need to edit.

will be the following section in sv_config.lua;

 ServerCfg.CreateCall = function(VoiceCall)

    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
    -- We are not responsible for the audio connections,
    -- you need to adapt it to your own audio, radio scripts,
    -- we only left an example for pma voice.
    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
end

In this section you will need to add your own script's trigger or export!

In the same way you need to modify these triggers to leave the searches!

Config.LeaveCall = function(VoiceCall)

    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
    -- We are not responsible for the audio connections,
    -- you need to adapt it to your own audio, radio scripts,
    -- we only left an example for pma voice.
    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!

    nowcalling = false
    exports["pma-voice"]:setRadioChannel(0)

    if Config.CallFromServerSide == true then 
        TriggerServerEvent("s4-report:redirectToServer:leave", VoiceCall)
    end
    -- exports.saltychat:SetRadioChannel('', true)

    -- local playerName = GetPlayerName(PlayerId())
    -- local getPlayerRadioChannel = exports.tokovoip_script:getPlayerData(playerName, "radio:channel")

    -- exports.tokovoip_script:removePlayerFromRadio(getPlayerRadioChannel)
    -- exports.tokovoip_script:setPlayerData(playerName, "radio:channel", "nil", true)
end

In this section you will need to add your own script's trigger or export!

If your voice script uses a server side trigger or export, this is the part you need to edit.

will be the following section in sv_config.lua;

 ServerCfg.CreateCall = function(VoiceCall)

    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
    -- We are not responsible for the audio connections,
    -- you need to adapt it to your own audio, radio scripts,
    -- we only left an example for pma voice.
    -- !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!! !!!! IMPORTANT !!!
end

Note if your voice script is server side, change this variable in config lua to true.

Config.CallFromServerSide = false