Config

Config for msk_handcuffs

Config = {}
----------------------------------------------------------------
Config.Locale = 'de'
Config.Debug = true
Config.VersionChecker = true
----------------------------------------------------------------
-- Add the Webhook Link in server_discordlog.lua
Config.DiscordLog = true
Config.botColor = "6205745" -- https://www.mathsisfun.com/hexadecimal-decimal-colors.html
Config.botName = "MSK Scripts"
Config.botAvatar = "https://i.imgur.com/PizJGsh.png"
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
Config.Notification = function(source, message, typ)
    if IsDuplicityVersion() then -- serverside
        MSK.Notification(source, 'MSK Handcuffs', message, typ, 5000)
    else -- clientside
        MSK.Notification('MSK Handcuffs', message, typ, 5000)
    end
end
----------------------------------------------------------------
-- You have to use 'cuffItems' before you can use 'hardcuffItems'
Config.cuffItems = {'cuffs', 'cable_ties'} -- DisableAllControlActions exept Movement 
Config.hardcuffItems = {'hardcuff'} -- Freeze Player Position
Config.uncuffItems = {'cuff_keys', 'scissors'}

Config.ItemSettings = {
    -- ['cuff_item'] = {'uncuff_item_1', 'uncuff_item_2', ...}
    -- You can only uncuff someone with 'uncuff_item' item if the player was cuffed with the 'cuff_item'
    -- Please don't add hardcuffItems, ankletracker, headbag or tape here!

    ['cuffs'] = {'cuff_keys'},
    ['cable_ties'] = {'scissors'},
}

-- Maybe you know this from our documentation
Config.RestrictItems = {
    enable = true, -- Set to true to restrict items/options

    -- Default Options for every Player and Job
    defaultItems = {
        cuffItem = 'cable_ties',
        hardcuffItem = 'hardcuff',
        uncuffItem = 'scissors',
        enableAnkletracker = false, 
        enableHeadbag = true,
        enableTape = true,
    },

    -- Specific Options for Jobs
    jobItems = {
        ['police'] = {
            cuffItem = 'cuffs',
            hardcuffItem = 'hardcuff',
            uncuffItem = 'cuff_keys',
            enableAnkletracker = true,
            enableHeadbag = true,
            enableTape = true,
        },
        ['doj'] = {
            cuffItem = 'cuffs',
            hardcuffItem = 'hardcuff',
            uncuffItem = 'cuff_keys',
            enableAnkletracker = true,
            enableHeadbag = true,
            enableTape = true,
        },
    }
}

Config.Commands = {
    cuff = {
        enable = true,
        command = 'cuff',
        item = 'cable_ties', -- Item for non specific jobs
        jobs = {
            -- Item for specific jobs
            ['police'] = 'cuffs',
            ['doj'] = 'cuffs',
        }
    },
    hardcuff = {
        enable = true,
        command = 'hardcuff',
        item = 'hardcuff', -- Item for non specific jobs
        jobs = {
            -- Item for specific jobs
            ['police'] = 'hardcuff',
            ['doj'] = 'hardcuff',
        }
    },
    uncuff = {
        enable = true,
        command = 'uncuff',
        item = 'scissors', -- Item for non specific jobs
        jobs = {
            -- Item for specific jobs
            ['police'] = 'cuff_keys',
            ['doj'] = 'cuff_keys',
        }
    },
}
----------------------------------------------------------------
-- Jobs can track the players position // Saved even if the player reconnects
Config.AnkleTracker = {
    enable = true,
    refreshTime = 5.0, -- in seconds // Refreshtime if player is not in OneSync distance // If player is in OneSync Distance then the player will be refreshed realtime
    item = 'ankletracker', -- Use this item to activate/deactivate // Will be removed after use
    removeItem = 'other_item_than_ankletracker', -- Item to remove the AnkleTracker // Needs to be another item than the item set above!
    command = 'ankletracker', -- You need the item in your inventory // Set to false to deactivate the command
    blip = {id = 1, color = 15, scale = 0.8, prefix = 'Track'},
    jobs = {
        -- Jobs who can see the Players with an ankletracker
        'police', 
        'fib',
        'sheriff', 
        'doj'
    },
}
----------------------------------------------------------------
-- Bag on the head of the player and blackscreen
Config.HeadBag = {
    enable = true,
    item = 'headbag', -- Use this item to activate/deactivate // Will be removed after use
    removeItem = 'other_item_than_headbag', -- Item to remove the Headbag // Needs to be another item than the item set above!
    command = 'headbag', -- You need the item in your inventory // Set to false to deactivate the command
}
----------------------------------------------------------------
-- This is to mute players
Config.Tape = {
    enable = true,
    item = 'tape', -- Use this item to activate/deactivate // Will be removed after use
    removeItem = 'other_item_than_tape', -- Item to remove the Tape // Needs to be another item than the item set above!
    command = 'tape', -- You need the item in your inventory // Set to false to deactivate the command
}
----------------------------------------------------------------
Config.addCuffItems = true -- Set to false if you don't want to give the cuffs item back if you uncuff someone
Config.UncuffOnPlayerDied = true -- Set to false if you don't want to uncuff the player if he dies

-- Check status from DB on PlayerLoaded / Player joined server
Config.checkOnPlayerLoaded = {
    cuff = true, -- recommend set true
    hardcuff = false,
    ankleTracker = true, -- recommend set true
    headbag = false,
    tape = false,
}

Config.playSound = {
    enable = true, -- Play sound on cuff and uncuff

    -- Add your own sounds here // Upload them into html/sounds
    cuff = 'cuff.ogg',
    hardcuff = 'cuff.ogg',
    uncuff = 'uncuff.ogg',
    ankleTracker = 'cuff.ogg',
    headBag = false,
    tape = false,
}

Config.Timer = {
    enable = true, -- Set false to disable this feature
    time = 30 -- in minutes // After this time the player gets uncuffed
}

Config.EnableProps = true -- Set false to completely disable props
Config.Props = {
    -- Use `` and NOT '' or ""
    -- Example: ['itemName'] = `prop`
    -- Set ['itemName'] = nil to deactivate the prop

    ['cuffs'] = `p_cs_cuffs_02_s`,
    ['cable_ties'] = `p_cs_cuffs_02_s`,

    ['hardcuff'] = nil,

    ['cuff_keys'] = `prop_cuff_keys_01`,
    ['scissors'] = `prop_cuff_keys_01`,

    [Config.AnkleTracker.item] = nil,
    [Config.HeadBag.item] = `prop_money_bag_01`,
    [Config.Tape.item] = `prop_gaffertape`,
}
----------------------------------------------------------------
-- Admin Commands
Config.AdminGroups = {'superadmin', 'admin'} -- You can set multiple groups

Config.AdminCommands = {
    cuff = {
        enable = true,
        command = 'adcuff', -- /adcuff playerID
        playAnimation = false
    },
    hardcuff = {
        enable = true,
        command = 'adhardcuff' -- /adhardcuff playerID
    },
    uncuff = {
        enable = true,
        command = 'aduncuff' -- /aduncuff playerID
    },
    ankleTracker = {
        enable = true,
        command = 'adankletracker' -- /adankletracker playerID
    },
    headbag = {
        enable = true,
        command = 'adheadbag' -- /adheadbag playerID
    },
    tape = {
        enable = true,
        command = 'adtape' -- /adtape playerID
    }
}
----------------------------------------------------------------
Config.Voice = {
    enable = false, -- To deactivate the Radio Channel if someone is handcuffed
    voice = 'pma' -- Set to 'salty' or 'pma'
}

-- To deactivate the Radio Channel if someone gets handcuffed
Config.SetRadioChannel = function()
    if not Config.Voice.enable then return end
    logging('debug', 'Config.SetRadioChannel')

    if Config.Voice.voice == 'salty' then
        exports["saltychat"]:SetRadioChannel(nil, true) -- https://github.com/v10networkscom/saltychat-fivem#setradiochannel
    elseif Config.Voice.voice == 'pma' then
        exports["pma-voice"]:setVoiceProperty('radioEnabled', false) -- https://github.com/AvarianKnight/pma-voice/blob/main/docs/client-setters/setVoiceProperty.md
        exports["pma-voice"]:SetRadioChannel(0) -- https://github.com/AvarianKnight/pma-voice/blob/main/docs/client-setters/setRadioChannel.md
    end
end

-- This is for Config.Tape to mute players
-- Seems to work only for pma-voice ...
Config.MutePlayer = function(source, state)
    if not Config.Tape.enable then return end

    if IsDuplicityVersion() then
        -- This is serverside
        Player(source).state:set('muted', state, true)
        MumbleSetPlayerMuted(source, state)

        if Config.Voice.voice == 'salty' then
            exports["saltychat"]:SetPlayerAlive(source, not state) 
        elseif Config.Voice.voice == 'pma' then
            -- Nothing to do here
        end
    else
        -- This is clientside
        Player(source).state:set('muted', state, true)

        if Config.Voice.voice == 'salty' then
            -- Nothing to do here
        elseif Config.Voice.voice == 'pma' then
            exports["pma-voice"]:toggleMutePlayer(source)
        end
    end
end
----------------------------------------------------------------
-- !!! This function are clientside ONLY and inside a Thread (triggerd every frame) !!!
Config.Method = 'blacklist' -- Set to 'whitelist' or 'blacklist'

-- This is triggerd if the player gets cuffed
Config.Handcuffed = function()
    if Config.Method == 'whitelist' then
        EnableControlAction(0, 1, true) -- Camera Movement
        EnableControlAction(0, 2, true) -- Camera Movement
        EnableControlAction(0, 245, true) -- T (Chat)
        EnableControlAction(0, 23, true) -- F (Enter Vehicle)
        EnableControlAction(0, 75, true) -- F (Exit Vehicle)
    elseif Config.Method == 'blacklist' then
        DisableControlAction(0, 24, true) -- Attack
		DisableControlAction(0, 257, true) -- Attack 2
		DisableControlAction(0, 25, true) -- Aim
		DisableControlAction(0, 263, true) -- Melee Attack 1
        DisableControlAction(0, 45, true) -- Reload

		DisableControlAction(0, 22, true) -- Jump
		DisableControlAction(0, 44, true) -- Cover
		DisableControlAction(0, 37, true) -- Select Weapon

		DisableControlAction(0, 288,  true) -- F1
		DisableControlAction(0, 289, true) -- F2
		DisableControlAction(0, 170, true) -- F3
		DisableControlAction(0, 167, true) -- F6 
        DisableControlAction(0, 73, true) -- X
		DisableControlAction(2, 199, true) -- P

        DisableControlAction(0, 59, true) -- Disable steering in vehicle
		DisableControlAction(0, 71, true) -- Disable driving forward in vehicle
		DisableControlAction(0, 72, true) -- Disable reversing in vehicle

        DisableControlAction(2, 36, true) -- Disable going stealth
        DisableControlAction(0, 47, true)  -- Disable weapon
		DisableControlAction(0, 264, true) -- Disable melee
		DisableControlAction(0, 257, true) -- Disable melee
		DisableControlAction(0, 140, true) -- Disable melee
		DisableControlAction(0, 141, true) -- Disable melee
		DisableControlAction(0, 142, true) -- Disable melee
		DisableControlAction(0, 143, true) -- Disable melee
    end
end

Last updated