HEX
HexscriptsVersion 1.0Hud

Configurations

Here you will get all configurations & open source files that are included within this script.

Config Files

Config = {}

Config.Locale = 'de'

Config.Voice = {
    System = 'saltychat',
    Ranges = { 1, 3.5, 8, 32 }
}

Config.Waits = {
    Vehicle = 0,
}

Config.Circle = {
    keymappings = {
        z = {
            command = 'openzmenu',
            desc = 'Open The Z Menu',
            mapper = 'keyboard',
            key = 'Z',
            outKey = 0xFA4BE86E
        },

        x = {
            command = 'opensxmenu',
            desc = 'Open The X Menu',
            mapper = 'keyboard',
            key = 'X',
            outKey = 0xD05D6855
        }
    },

    actions = {
        x = {
            player = {
                {
                    label = 'Schlüssel',
                    img = '',

                    action = function()
                        print('Schlüssel')
                    end
                },

                {
                    label = 'Kofferraum',
                    img = '',
                    
                    action = function()
                        print('Kofferraum')
                    end
                },

                {
                    label = 'Durchsuchen',
                    img = '',
                    
                    action = function()
                        print('Durchsuchen')
                    end
                },

                {
                    label = 'Fesseln',
                    img = '',
                    
                    action = function()
                        print('Fesseln')
                    end
                }
            },

            vehicle = {
                {
                    label = 'Schlüssel',
                    img = '',
                    
                    action = function()
                        print('Schlüssel')
                    end
                },

                {
                    label = 'Motor',
                    img = '',
                    
                    action = function()
                        local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)

                        if GetIsVehicleEngineRunning(vehicle) then
                            SetVehicleEngineOn(vehicle, false, false, true)
                            SetVehicleUndriveable(vehicle, true)
                        elseif not GetIsVehicleEngineRunning(vehicle) then
                            SetVehicleEngineOn(vehicle, true, false, true)
                            SetVehicleUndriveable(vehicle, false)
                        end
                    end
                },

                {
                    label = 'Radio',
                    img = '',
                    
                    action = function()
                        if IsPlayerVehRadioEnable() then
                            SetVehicleRadioEnabled(GetVehiclePedIsIn(PlayerPedId(), false), false)
                        else
                            SetVehicleRadioEnabled(GetVehiclePedIsIn(PlayerPedId(), false), true)
                        end
                    end
                }
            }
        },

        z = {
            {
                label = 'Arme kreuzen',
                img = '',
                
                action = function()
                    startAnim("anim@amb@nightclub@peds@", "rcmme_amanda1_stand_loop_cop")
                end
            },

            {
                label = 'Aufgeben',
                img = '',
                
                action = function()
                    startAnim("random@arrests@busted", "idle_a")
                end
            },

            {
                label = 'Hinsetzten',
                img = '',
                
                action = function()
                    startAnim('timetable@ron@ig_5_p3', 'ig_5_p3_base')
                end
            },

            {
                label = 'Liegend (Rückend)',
                img = '',
                
                action = function()
                    startAnim('amb@world_human_sunbathe@male@back@base', 'base')
                end
            },

            {
                label = 'Umarmen',
                img = '',
                
                action = function()
                    startAnim('mp_ped_interaction', 'hugs_guy_a')
                end
            },

            {
                label = 'Mittelfinger',
                img = '',
                
                action = function()
                    startAnim('anim@mp_player_intselfiethe_bird', 'idle_a')
                end
            },

            {
                label = 'Sitzen',
                img = '',
                
                action = function()
                    startAnim('anim@amb@business@bgen@bgen_no_work@', 'sit_phone_phoneputdown_idle_nowork')
                end
            },

            {
                label = 'Anlehnen',
                img = '',
                
                action = function()
                    startAnim("amb@world_human_leaning@male@wall@back@foot_up@idle_a", "idle_a")
                end
            }
        }
    }
}

Config.TxAnnounces = {
    restart = {
        enable = true, -- if true it will use txAdmin restarts, dont forget to hide it in the settings from txAdmin
        type = 'announcement', -- announcement | notify
        timeout = 8000 -- ms how long the restart announcement should be shown
    },
    announcement = {
        enable = true, -- if true it will use txAdmin announcements, dont forget to hide it in the settings from txAdmin
        type = 'announcement', -- announcement | notify
        timeout = 8000 -- ms how long the announcement should be shown
    },
    directMessage = {
        enable = true, -- if true it will use txAdmin Direct Messages, dont forget to hide it in the settings from txAdmin
        type = 'notify', -- announcement | notify
        timeout = 7000 -- ms how long the direct message should be shown
    },
}

Config.Permissions = {
    teamchat = {
        'projektleitung',
        'superadmin',
        'admin'
    },

    announce = {
        'projektleitung',
        'superadmin',
        'admin'
    }
}

Config.BlacklistedStrings = {
	"<",
	">",
	"script",
	"img",
	"video",
	"iframe",
	"audio",
	"mp3",
	"mp4",
	"ogg",
	"webm"
}

Config.NotifySound = {
    ["notify"] = {
        mp3 = false,
        gta = {
            audioName = 'ATM_WINDOW',
            audioRef = 'HUD_FRONTEND_DEFAULT_SOUNDSET'
        },
        url = 'sounds/alarm.mp3'
    },

    ["announce"] = {
        mp3 = false,
        gta = {
            audioName = 'CHALLENGE_UNLOCKED',
            audioRef = 'HUD_AWARDS'
        },
        url = 'sounds/alarm.mp3'
    }
}

Config.Commands = {
    ["id"] = {
        command = 'id',
        enabled = true
    },

    ["ids"] = {
        command = 'ids',
        enabled = true
    },

    ["ooc"] = {
        command = 'ooc',
        enabled = true
    },

    ["tc"] = {
        command = 'tc',
        enabled = true
    },

    ["announce"] = {
        command = 'announce',
        enabled = true
    }
}

Config.Locales = {
    ['de'] = {
        ['info'] = 'Information!',
        ['your_id'] = 'Deine Id Lautet: %s',
        ['no_player'] = 'Kein Spieler in der Nähe!',
        ['near_player_id'] = 'Seine Id Lautet: %s',

        ['tx_admin_restart'] = 'Geplanter Neustart',
        ['tx_admin_announce'] = 'Serverankündigung von %s',
        ['tx_admin_dm'] = 'Direktnachricht von %s',
    },
    
    ['en'] = {
        ['info'] = 'Information!',
        ['your_id'] = 'Your Id Is: %s',
        ['no_player'] = 'No player nearby!',
        ['near_player_id'] = 'His Id Is: %s',

        ['tx_admin_restart'] = 'Scheduled Restart',
        ['tx_admin_announce'] = 'Server announcement by %s',
        ['tx_admin_dm'] = 'Direct Message from %s',
    }
}

function cancelAnim(category)
    if category == 'player' then
        ClearPedTasks(PlayerPedId())
    elseif category == 'vehicle' then
        ClearPedTasks(PlayerPedId())
    elseif category == 'emote' then
        ClearPedTasks(PlayerPedId())
    end
end

function startAnim(animDict, name)
    if not HasAnimDictLoaded(animDict) then
		RequestAnimDict(animDict)

		while not HasAnimDictLoaded(animDict) do
			Citizen.Wait(1)
		end
	end

    TaskPlayAnim(PlayerPedId(), animDict, name, 8.0, -8.0, -1, 1, 0, false, false, false)
end

Open Source Files

Citizen.CreateThread(function()
    if Config.Voice.System == 'saltychat' then
        AddEventHandler('SaltyChat_VoiceRangeChanged', function(voiceRange, index, availableVoiceRanges)
            SendNUIMessage({
                action = 'voice',
                data = {
                    type = 'range',
                    range = index,
                    availableVoiceRanges = availableVoiceRanges
                }
            })
        end)
        
        AddEventHandler('SaltyChat_MicStateChanged', function(isMicrophoneEnabled)
            SendNUIMessage({
                action = 'voice',
                data = {
                    type = 'mic',
                    state = isMicrophoneEnabled
                }
            })
        end)
        
        AddEventHandler('SaltyChat_TalkStateChanged', function(isTalking)
            SendNUIMessage({
                action = 'voice',
                data = {
                    type = 'speak',
                    state = isTalking
                }
            })
        end)
        
        AddEventHandler('SaltyChat_RadioChannelChanged', function(radioChannel, isPrimaryChannel)
            if radioChannel and radioChannel ~= '0' then
                SendNUIMessage({
                    action = 'voice',
                    data = {
                        type = 'radio',
                        state = true
                    }
                })
            else
                SendNUIMessage({
                    action = 'voice',
                    data = {
                        type = 'radio',
                        state = false
                    }
                })
            end
        end)
    elseif Config.Voice.System == 'pma' then
        local function stringStarts(string, start)
            return string:sub(1, string.len(start)) == start
        end

        AddStateBagChangeHandler('radioChannel', 'player:' .. GetPlayerServerId(PlayerId()), function(bagName, key, value, reserved, replicated)
            if replicated or not stringStarts(bagName, "player:") then
                return
            end

            SendNUIMessage({
                action = 'voice',
                data = {
                    type = 'radio',
                    state = value ~= 0
                }
            })
        end)

        Citizen.CreateThread(function()
            local isTalking = false

            while true do
                Citizen.Wait(33)
                local networkTalking = NetworkIsPlayerTalking(PlayerId())

                if not isTalking and networkTalking then
                    isTalking = true

                    SendNUIMessage({
                        action = 'voice',
                        data = {
                            type = 'speak',
                            state = true
                        }
                    })
                elseif isTalking and not networkTalking then
                    isTalking = false
                    
                    SendNUIMessage({
                        action = 'voice',
                        data = {
                            type = 'speak',
                            state = false
                        }
                    })
                end
            end
        end)

        AddEventHandler('pma-voice:setTalkingMode', function(voiceMode)
            SendNUIMessage({
                action = 'voice',
                data = {
                    type = 'range',
                    range = voiceMode - 1,
                    availableVoiceRanges = #Config.Voice.Ranges
                }
            })
        end)
    end
end)