Documentation
  • Weed Script
    • Installation
      • RedEM-RP
      • RSG
      • QR CORE
      • QBR CORE
      • VORP
      • SQL
    • Accessible code
  • Report System
    • Installation
    • Accessible code
  • SafeZone Creator
    • Installation
    • SQL File
    • Accessible code
  • Promo Codes Creator
    • Installation
    • Accessible code
  • Player Manager
    • Installation
    • Accessible code
Powered by GitBook
On this page
  1. SafeZone Creator

Accessible code

Shared = {
    Locale = 'en',

    Notify = {
        duration = 5000, -- miliseconds
        position = 'top-right' -- 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left'
    },
    
    Logs = {
        enabled = true,
        webhook = 'https://discord.com/api/webhooks/1204844463147454545/bg6-cR3DUtFZA8coWq3jiT0VWGiARzjqoKAT-zjdywrVgsJeRguIPBrhYUl84KkBsiyb',
        servername = 'Enpwr Scripts',
        color = 13448238,
        icon_url = 'https://dunb17ur4ymx4.cloudfront.net/webstore/logos/3aaeea0cc6e65e87b250d6a6f4bc4c75f9b6192f.png'
    },

    Commands = {
        safezonecreator = {
            name = 'safezonecreator',       -- command for accessing creator menu: create safe zone, delete safe zone, safe zones list
            restricted = 'group.admin',     -- group that will have acces to command 
        }
    },

    Keys = { -- https://docs.fivem.net/docs/game-references/controls/
        finish = 0xC7B5340A,
        cancel = 0x156F7119,
        finishPlacingPoints = 0x760A9C6F,
    },

    TextUI_Position = 'top-center', -- 'right-center' or 'left-center' or 'top-center'
    
    TextUI = {
        text = 'You are in the Safe Zone',
        icon = 'shield-alt',
        style = {
            borderRadius = 5,
            backgroundColor = '#cd342e',
            color = 'white'
        }
    },

    CreatorOptions = { -- enable or disable options in safe zone admin creator menu - *THIS ONLY DECIDES WHETHER THESE FEATURES WILL BE ENABLED WHEN CREATING THE SAFE ZONE, IF YES THE ADMIN WILL STILL HAVE TO CHECK/UNCHECK THE OPTIONS WHEN CREATING THE SAFE ZONE IF HE WANT TO TURN THEM ON/OFF FOR THE SAFE ZONE*
        maxVehSpeed = true,
        textUI = true,
        weapons = true,
        players_invisible = true,
        vehicles_invisible = true
    },

    MaxSpeedMultiplier = 3.6, -- 3.6 for kmh, 2.236936 for mph
    MaxPoints = 30, -- the maximum amount of points that can be made
    ClosestRadius = 10, -- radius in which the script will search for the nearest safe zone that needs to be deleted when the "closest" option is selected
}
function sendNotify(title, description, type)
    lib.notify({
        title = title,
        description = description,
        duration = Shared.Notify.duration,
        type = type,
        position = Shared.Notify.position
    })
end

RegisterNetEvent('safezonecreator:notify', sendNotify)
-- Discord Logs
local webhook = Shared.Logs.webhook

function logger(message)
    if Shared.Logs.enabled then
        if webhook ~= '' then
            PerformHttpRequest(webhook, function(status) end, 'POST', json.encode({
                username = cache.resource,
                embeds = {{
                    color = Shared.Logs.color,
                    title = Shared.Logs.servername,
                    description = message,
                    footer = {
                        text = os.date(),
                        icon_url = Shared.Logs.icon_url
                    }
                }}
            }), { ['Content-Type'] = 'application/json' })
        end
    end
end

-- Command
lib.addCommand(Shared.Commands.safezonecreator.name, {
    help = L('command.creator.description'),
    restricted = Shared.Commands.safezonecreator.restricted
}, function(source)
    TriggerClientEvent("safezonecreator:adminMenu", source)
end)
Locales['en'] = {
    --- # Commands # ---
    ['command.creator.description'] = 'Access the Safe Zone Creator menu',
    --- ! # Commands # ---

    --- # Menu # ---
    -- Menu
    ['menu.admin_menu'] = 'Safe Zone Creator',
    ['menu.create_safezone'] = 'Create Safe Zone',
    ['menu.delete_safezone'] = 'Delete Safe Zone',
    ['menu.safezones_list'] = 'Safe Zones List',
    ['menu.refresh_safezones'] = 'Refresh Safe Zones',

    -- Input
    ['input.safezone_label'] = 'Label',
    ['input.safezone_label.description'] = 'Label for this Safe Zone, will be displayed in safezones list menu',
    ['input.safezone_label.placeholder'] = 'Saint Denis',
    ['input.safezone_points'] = 'Points',
    ['input.safezone_points.description'] = 'Safe Zone points with which the safe zone will be marked',
    ['input.text_ui'] = 'Text UI (help text)',
    ['input.allow_weapons'] = 'Allow Weapons',
    ['input.players_invisible'] = 'Players Invisible',
    ['input.vehicles_invisible'] = 'Vehicles Invisible',
    ['input.delete_safezone'] = 'Delete Safe Zone',
    ['input.select_option'] = 'Select Option',
    ['input.input_radius'] = 'Input Radius',
    ['input.input_id'] = 'Input Safe Zone database ID to delete',
    ['input.delete_id'] = 'Delete By Safe Zone ID',
    ['input.delete_closest'] = 'Delete Closest Safe Zone In %sm Radius',
    ['input.delete_radius'] = 'Delete All Safe Zones In Radius',

    -- Context
    ['context.safezone_id'] = 'Safe Zone #%s',
    ['context.safezone_name'] = 'Label: %s',
    ['context.edit_name'] = 'Edit Safe Zone Label',
    ['context.current_name'] = 'Current Label',
    ['context.teleport'] = 'Teleport To Safe Zone',
    ['context.teleport.description'] = 'This will teleport you to Safe Zone #%s',
    ['context.edit_points'] = 'Edit Points',
    ['context.edit_points.description'] = 'Remove or change location of safe zone points',
    ['context.points_list'] = 'Safe Zone Points',
    ['context.point_id'] = 'Point #%s',
    ['context.teleport_point'] = 'Teleport To Point',
    ['context.delete_point'] = 'Delete Point',
    ['context.delete_point.description'] = 'This will permanently delete Point #%s for Safe Zone #%s',
    ['context.edit_point_coords'] = 'Edit Point Coordinates',
    ['context.edit_point_coords.description'] = 'Move point permanently to different location',
    ['context.add_points'] = 'Add Points',
    ['context.add_points.description'] = 'Add points for this safe zone, you can later edit or delete them',
    ['context.delete_safezone.description'] = 'This will delete this Safe Zone permanently. All data will be lost',
    ['context.safezone_settings'] = 'Safe Zone Settings',
    ['context.safezone_settings.description'] = 'Configure this Safe Zone. It is possible to configure all the settings configurable in safe zone creator',

    --- ! # Menu # ---

    --- # Notify # ---
    ['notify.success_cancel'] = 'You have cancelled creating Safe Zone',
    ['notify.success_cancel_points'] = 'You have cancelled creating points',
    ['notify.point_id_created'] = 'Point #%s placed',
    ['notify.all_points_created'] = 'All points placed',
    ['notify.safezone_created'] = 'Safe Zone "%s" successfully created',
    ['notify.no_safezones_in_radius'] = 'There are no Safe Zones in radius %sm',
    ['notify.safezone_deleted'] = 'Safe Zone #%s is successfully deleted',
    ['notify.safezone_not_exist'] = 'Safe Zone #%s does not exist',
    ['notify.name_edited'] = 'Successfully changed name for Safe Zone #%s to "%s" ',
    ['notify.teleported'] = 'Successfully teleported to Safe Zone #%s - "%s"',
    ['notify.canceled_updating'] = 'You have cancelled updating safe zone point',
    ['notify.safezone_configured'] = 'Safe Zone #%s is successfully configured',
    ['notify.points_updated'] = 'Points for Safe Zone #%s successfully updated',
    ['notify.point_deleted'] = 'Point #%s in Safe Zone #%s successfully deleted',
    ['notify.point_updated'] = 'Coords for point #%s in Safe Zone #%s successfully updated',
    ['notify.nothing_configurable'] = 'Nothing can be configured here (Contact Developer)',
    --- ! # Notify # ---
    
    --- # Text UI # ---
    ['textui.creating_point'] = {
        ('[ENTER] - Set point #%s  \n'),
        ('[BACKSPACE] - Cancel creating Safe Zone  \n'),
    },
    ['textui.creating_points'] = {
        ('[ENTER] - Set point #%s  \n'),
        ('[G] - Finish creating points  \n'),
        ('[BACKSPACE] - Cancel creating points (everything will be dismissed)  \n'),
    },
    ['textui.editing_point'] = {
        ('[ENTER] - Update point #%s location  \n'),
        ('[BACKSPACE] - Cancel updating point  \n')
    },
    --- ! # Text UI # ---
    
    --- # Alert Dialog # ---
    ['alert.cancel_creating'] = 'Cancel Creating Safe Zone',
    ['alert.cancel_creating.sure'] = 'Are you sure you want to cancel creating this safe zone? The progress will not be saved.',
    ['alert.delete_point'] = 'Delete Point',
    ['alert.delete_point.sure'] = 'Are you sure you want to delete this point? The point will be deleted permanently.',
    ['alert.cancel_creating_points'] = 'Cancel Creating Points',
    ['alert.cancel_creating_points.sure'] = 'Are you sure you want to cancel creating points for this safe zone? The progress will not be saved.',
    ['alert.delete_safezone'] = 'Delete Safe Zone',
    ['alert.delete_safezone.sure'] = 'Are you sure you want to delete safe zone? The data will be lost permanently.',
    --- ! # Alert Dialog # ----

    --- # Logs # ---
    ['logs.safezone_created'] = '%s just created a new Safe Zone.\nLabel: **%s**\nData: **%s**',
    ['logs.safezone_deleted'] = '%s just deleted a Safe Zone #%s',
    ['logs.safezone_label_edited'] = '%s just edited a Safe Zone #%s label.\nNew Label: **%s**',
    ['logs.point_updated'] = '%s just edited point #%s for Safe Zone #%s',
    --- ! # Logs # ---
}
PreviousSQL FileNextPromo Codes Creator

Last updated 1 year ago