[esx/qb/custom] gps script (open-source)

:shopping_cart:Download here: 4projects.dev

If you’re experiencing any issues, don’t worry! We’ve got you covered. Just open a ticket in our Discord, and our team will work hard to assist you.

If you know some other free gps-scripts, you may noticed their performance is everything, but not good. We did a new gps script with the best performance possible!

Config
_4p = {
 
    --[[ Framework: Define the framework in use for this script.
         Options:
         - "esx": For ESX framework
         - "qbcore": For QBCore framework
         - "custom": For custom frameworks (requires custom notification functions)
    --]]
    Framework = "esx",

    -- item_name: The name of the GPS item in the game, which players use to enable or disable GPS.
    item_name = "gps",

    -- disabled_jobs: A list of job names that are not allowed to use the GPS.
    -- Players with jobs listed here will receive a notification that GPS use is restricted.
    disabled_jobs = {"unemployed"},

    -- events: Specifies critical events needed for the GPS system to function properly in the selected framework.
    events = {
        -- onPlayerLoaded: Event triggered when a player has fully loaded. Used to cache the player's job.
        onPlayerLoaded = "esx:playerLoaded",
        
        -- setJob: Event triggered when a player’s job changes, allowing the script to update the player's GPS access.
        setJob = "esx:setJob",
        
        -- deathEvent: Event triggered when a player dies, used to automatically disable GPS upon death.
        deathEvent = "esx:onPlayerDeath"
    },

    -- lang: Sets the language of the GPS notifications. Default is "en" (English).
    lang = "en",

    --[[ createNotify: Function to send notifications to players based on the framework.
         Parameters:
         - playerID: The ID of the player receiving the notification.
         - title: Title of the notification.
         - message: Content/message of the notification.
         - notify_type: Type of notification (e.g., success, error).
    --]]
    createNotify = function(self, playerID, title, message, notify_type)
        -- Server-side notification
        if IsDuplicityVersion() then
            if self.Framework == "esx" then
                TriggerClientEvent("esx:showNotification", playerID, message)
            elseif self.Framework == "qbcore" then
                TriggerClientEvent("QBCore:Notify", playerID, message)
            else
                print("^1[4p-gps] ^3Custom framework detected. Add a custom notification function in config.lua^7")
            end
        -- Client-side notification
        else
            if self.Framework == "esx" then
                Framework.object.ShowNotification(message)
            elseif self.Framework == "qbcore" then
                Framework.object.Functions.Notify(message)
            else
                print("^1[4p-gps] ^3Custom framework detected. Add a custom notification function in config.lua^7")
            end
        end
    end,
}

--[[ _4p.language: Defines the notifications in multiple languages.
     Available translations:
     - "not_allowed": Message shown when a player is not permitted to use the GPS.
     - "enabled_gps": Message shown when a player successfully enables GPS.
     - "disabled_gps": Message shown when a player disables GPS.
     - "notificationtitle": Title for GPS-related notifications.
--]]
_4p.language = {
    ["en"] = {
        not_allowed = "You are not allowed to use GPS",
        enabled_gps = "You have enabled your GPS for your faction.",
        disabled_gps = "You have disabled your GPS for your faction.",
        notificationtitle = "GPS System",
    }, 
    ["de"] = {
        not_allowed = "Du darfst kein GPS benutzen",
        enabled_gps = "Du hast dein GPS für deine Fraktion aktiviert.",
        disabled_gps = "Du hast dein GPS für deine Fraktion deaktiviert.",
        notificationtitle = "GPS-System",
    },
    ["fr"] = {
        not_allowed = "Vous n'êtes pas autorisé à utiliser le GPS",
        enabled_gps = "Vous avez activé votre GPS pour votre faction.",
        disabled_gps = "Vous avez désactivé votre GPS pour votre faction.",
        notificationtitle = "Système GPS",
    },
    ["es"] = {
        not_allowed = "No tienes permitido usar el GPS",
        enabled_gps = "Has activado tu GPS para tu facción.",
        disabled_gps = "Has desactivado tu GPS para tu facción.",
        notificationtitle = "Sistema de GPS",
    },
    ["pt"] = {
        not_allowed = "Você não tem permissão para usar o GPS",
        enabled_gps = "Você ativou seu GPS para sua facção.",
        disabled_gps = "Você desativou seu GPS para sua facção.",
        notificationtitle = "Sistema de GPS",

    },
    ["it"] = {
        not_allowed = "Non sei autorizzato a utilizzare il GPS",
        enabled_gps = "Hai attivato il tuo GPS per la tua fazione.",
        disabled_gps = "Hai disattivato il tuo GPS per la tua fazione.",
        notificationtitle = "Sistema GPS",
    },
    ["ru"] = {
        not_allowed = "Вам запрещено использовать GPS",
        enabled_gps = "Вы включили свой GPS для вашей фракции.",
        disabled_gps = "Вы отключили свой GPS для вашей фракции.",
        notificationtitle = "Система GPS",
    },
    ["pl"] = {
        not_allowed = "Nie masz uprawnień do korzystania z GPS",
        enabled_gps = "Włączyłeś GPS dla swojej frakcji.",
        disabled_gps = "Wyłączyłeś GPS dla swojej frakcji.",
        notificationtitle = "System GPS",
    },
}

:round_pushpin: Key Features:

🡂 Job-Based Access Control: Configure which jobs can access GPS functionality, allowing only specific roles to use it.
🡂 Automatic GPS Toggle: Players can activate or deactivate GPS for their job or faction, receiving notifications of status changes.
🡂 Realistic Roleplay Integration: GPS will automatically disable upon player death, adding a layer of immersion to the experience.
🡂 Multilingual Support: Choose from a variety of pre-set languages to ensure the script fits your server’s player base.
🡂 Simple Setup: Easily configure and integrate this GPS system with any FiveM server setup, whether you’re using ESX, QBCore, or a custom framework.


Code is accessible Yes
Subscription-based No
Lines (approximately) 200
Requirements ESX or QB-Core or Custom Framework
Support Yes
8 Likes

wooow its very nice script

but store link down

question when player use a vehicles it will show the vehicle as the blip on the map ??

5 Likes

link download not working

updated!

5 Likes

link updated!

3 Likes

open source?

2 Likes

yes! fully open source

1 Like

love it!

5 Likes

Store Buggy?

why buggy?