Viority Development
DiscordShop
  • 🏠Home
    • Welcome
    • FAQ
    • Common issues
  • Tutorials
    • βš™οΈProduct
      • How to get the Security Token?
      • How to create new locales?
      • getSharedObject Deprecated
  • 🀝Support
    • Support Policy
    • πŸ‡ΊπŸ‡ΈTicket Rules (EN)
    • πŸ‡©πŸ‡ͺTicket Rules (GER)
  • Products
    • πŸ”’Viority Script Lock
      • How to use
      • JavaScript example
      • Lua example
    • πŸ“‹Viority Advanced Menu
      • πŸ‘€Config Preview
      • Event Command
      • NotifyBoard
      • OpenMenu Event
      • CloseMenu Event
      • UpdateChallengeProgress
      • UpdateAchievementProgress
      • CheckAchievementProgress
      • CheckCurrentLevel
    • 🚘Viority Garage V2
      • πŸ‘€Config Preview
      • OpenGarage Event
      • CloseGarage Event
      • VehicleParkIn
      • VehicleParkIn DV
    • πŸš—Viority Cardealer
      • πŸ‘€Config Preview
      • Vehicle Color Fix
      • OpenCardealer Event
      • CloseCardealer Event
      • UpdateLeasingStatus
      • CheckPlate
      • CheckPlateBlacklist
      • GeneratePlate
    • β›½Viority Gasoline
      • πŸ‘€Config Preview
      • OpenGasoline Event
      • CloseGasoline Event
      • RefillFuelStock
      • GetFuel
      • SetFuel
    • πŸ’³Viority Billingmenu
      • πŸ‘€Config Preview
      • OpenBillingMenu Event
      • CloseBillingMenu Event
    • πŸ’Viority Marry
      • Page
      • πŸ‘€Config Preview
      • StartAnimation Event
      • StopAnimation Event
    • πŸ“ŠViority HUD
      • πŸ‘€Config Preview
        • PMA-Voice Example
        • Saltychat Example
      • Announce Command
      • TriggerNotifySystem
      • UpdateWantedStars
      • UpdateTransactionData
      • UpdateCurrentMission
      • GetWantedStars
    • πŸ•Viority Playtime Rewards
      • πŸ‘€Config Preview
      • ClosePlaytimeReward
      • OpenPlaytimeReward
      • CheckCurrentLevel
    • 🀝Viority Interaction
      • πŸ‘€Config Preview
      • ESX Interaction Integration
      • How to use
    • πŸ†”Viority SupportID
      • πŸ‘€Config Preview
      • getNearestPlayerID
      • getPlayerID
    • πŸ“Viority Register
      • πŸ‘€Config Preview
      • getAllPromocodes
      • getPlayerPromocode
    • 🏒Viority Fraction Request
      • πŸ‘€Config Preview
    • 🌐Viority LifeInvader
      • πŸ‘€Config Preview
    • πŸ””Viority LifeInvader Notify
      • πŸ‘€Config Preview
      • Notify
    • πŸͺ™Viority Trading
      • πŸ‘€Config Preview
      • OpenTradingMenu Event
      • CloseTradingMenu Event
  • πŸ“ŒDiscord Server
Powered by GitBook
On this page
  1. Products
  2. Viority HUD
  3. Config Preview

PMA-Voice Example

πŸ”§ See the PMA-Voice Example

PMA-Voice Example
-- IMPORTANT THIS FILE IS JUST A EXAMPLE!!!
-- To use it you need to replace this functions in the ViorityCore.lua
-- Please consider that you start the PMA-Voice Resource before this Script to use the Voice Chat features...

-- Voice Plugin Functions (See Examples in the settings folder)
ViorityCore.TalkingEvent = function() -- This example is for PMA-Voice!!!
    if GetResourceState('pma-voice') ~= 'started' then return print('^5[Viority-Development]^7 PMA-Voice is not installed or not running! Please start PMA-Voice before this Script to use the Voice Chat features...'); end;

    Citizen.CreateThread(function()
        while true do
            SendNUIMessage({
                type = "update:talkstate",
                isTalking = MumbleIsPlayerTalking(PlayerId()) == 1 -- True or false?
            })
            Citizen.Wait(250);
        end;
    end);

end;

local isDrawing = false; -- Variable for RangeEvent
ViorityCore.RangeEvent = function() -- This example is for PMA-Voice!!!
    if GetResourceState('pma-voice') ~= 'started' then return print('^5[Viority-Development]^7 PMA-Voice is not installed or not running! Please start PMA-Voice before this Script to use the Voice Chat features...'); end;

    AddEventHandler('pma-voice:setTalkingMode', function(voiceRange)
        local curProx = 0.0 -- don't touch!

        -- Voice Range Notify
        if voiceRange == 1 then
            curProx = 2.5;
            TriggerEvent(ViorityCore.InternalPrefix .. "client:" .. "Notify", 1, 1, "Sprachreichweite", "Die Sprachreichweite ist nun auf flΓΌstern");
        elseif voiceRange == 2 then
            curProx = 8.0;
            TriggerEvent(ViorityCore.InternalPrefix .. "client:" .. "Notify", 1, 1, "Sprachreichweite", "Die Sprachreichweite ist nun auf normal");
        elseif voiceRange == 3 then
            curProx = 20.0;
            TriggerEvent(ViorityCore.InternalPrefix .. "client:" .. "Notify", 1, 1, "Sprachreichweite", "Die Sprachreichweite ist nun auf schreien");
        end

        -- Voice Range Circle Drawing
        local markerType = 1 -- Change to a Marker of your choice - https://docs.fivem.net/docs/game-references/markers/

        local markerColorR = 0 -- Change Marker color here (RED)
        local markerColorG = 255 -- Change Magithrker color here (GREEN)
        local markerColorB = 255 -- Change Marker color here (BLUE)
        local markerAlpha = 0.6 -- Opacity of the Marker (0.0-1.0)
                
        local afterBurn = 1000 -- How long should the Marker be drawn after the range has been changed?
                

        isDrawing = false;
        Citizen.Wait(0);
        isDrawing = true;
       
        function drawMarker()
            while isDrawing do
                local posPlayer = GetEntityCoords(PlayerPedId())
                DrawMarker(markerType, posPlayer.x, posPlayer.y, posPlayer.z - 1, 0, 0, 0, 0, 0,0, curProx * 2, curProx * 2, 0.8001, markerColorR, markerColorG, markerColorB, markerAlpha, 0, 0, 0)
                Citizen.Wait(1);
            end;
        end;

        Citizen.CreateThread(function() 
         drawMarker();
        end);
        Citizen.Wait(afterBurn);
    
        isDrawing = false;
    end)
end;

ViorityCore.RadioEvent = function() -- This example is for PMA-Voice!!!
    if GetResourceState('pma-voice') ~= 'started' then return print('^5[Viority-Development]^7 PMA-Voice is not installed or not running! Please start PMA-Voice before this Script to use the Voice Chat features...'); end;

    local LastRadio = nil;
    Citizen.CreateThread(function()
        while true do
            local CurrentRadio = LocalPlayer.state.radioChannel or 0;

            if CurrentRadio ~= LastRadio then
                LastRadio = CurrentRadio;
                if CurrentRadio == 0 then
                    SendNUIMessage({
                        type = "update:radiostate",
                        visibility = false,
                        CurrentRadio = CurrentRadio
                    })
                
                else
                    SendNUIMessage({
                        type = "update:radiostate",
                        visibility = true,
                        CurrentRadio = CurrentRadio
                    })
                end
            end

            Citizen.Wait(1500);
        end
    end)
end;
PreviousConfig PreviewNextSaltychat Example

Last updated 1 year ago

πŸ“Š
πŸ‘€