ESX/QBCore Speedlimiter

A script by lvScripts

No reviews yet.
ESX/QBCore Speedlimiter main image

Full Description

Buy
Preview
Speedlimiter

Description: The LV_Speedlimiter script is designed to enforce speed limits for all vehicles within the game, ensuring a controlled and safe driving experience. This script is highly configurable and supports both ESX and QBCore frameworks, making it versatile and adaptable for various server setups.

Version 1.4.0

Features:

  • Framework Compatibility: Supports both ESX and QBCore frameworks, allowing seamless integration with your server’s existing setup.
  • Global Maximum Speed Setting: Added an option to enable or disable a global maximum speed (Config.EnableMaxSpeed). When enabled, all vehicles are limited to Config.MaxSpeed. When disabled, vehicles are limited based on their category (Config.CategorySpeeds).
  • Category Speed Limits: Added configuration for speed limits by vehicle category (Config.CategorySpeeds). This is used when Config.EnableMaxSpeed is set to false.
  • Exceptions: Vehicles listed in Config.Exceptions have their specific maximum speeds regardless of the global or category limits.
  • Unit Selection: Added the ability to choose between kilometers per hour (kmh) and miles per hour (mph) for speed limits (Config.SpeedUnit).
  • Player Group Ignorance: Added configuration to ignore speed limits for certain player groups, such as admins (Config.IgnoredGroups).
  • Speed Reduction Rate: Replaced Config.ReductionRate with Config.ReductionTime to set how quickly the speed should be reduced if a vehicle exceeds the speed limit.
  • Notification System:
    • Enable/Disable Notifications: Added the option to enable or disable notifications when a player enters a vehicle (Config.EnableNotification).
    • Custom Notification Event: The entire notification event can be customized in the config (Config.NotificationEvent), allowing server owners to integrate their preferred notification system.
    • Notification Message: Customizable notification text that informs players of the speed limit of the vehicle they entered (Config.NotificationText).
  • Text Display Settings: Added on-screen text display for speed limits with configurable message, duration, and color (Config.EnableTextDisplay, Config.TextDisplayMessage, Config.TextDisplayDuration, Config.TextDisplayColor).
  • Zone Configuration: Introduced zone-based speed limit management, including:
    • Enable/Disable Zones: Toggle the functionality of zones (Config.Zones.enabled).
    • Display Blips: Show or hide zone blips on the map (Config.Zones.displayBlips).
    • Blip Customization: Customize blip appearance with sprite, color, scale, and visibility settings (Config.Zones.blip).
    • Zone List: Define multiple zones with specific properties such as name, coordinates, radius, speed limit, enter/leave messages, reduction time, check interval, and display color (Config.Zones.zoneList).

Improvements:

  • Configurable Speed Units: Speed limits can now be configured in either km/h or mph, based on the server’s preference.
  • Notification Flexibility: Enhanced flexibility for notifications by allowing full customization of the notification event, message category, title, and length.
  • Performance Optimizations: Improved performance by optimizing the main thread and reducing unnecessary computations.

With these updates, the LV_Speedlimiter script provides a robust and flexible solution for managing vehicle speeds on your server, enhancing both control and realism for the players.



enter_zone
Config = {}

-- Framework: 'esx' or 'qbcore'
Config.Framework = 'esx'

-- Units for speed measurement: "kmh" or "mph"
Config.SpeedUnit = 'kmh'

-- Enable or disable the global maximum speed.
-- If true, Config.MaxSpeed is used, and Config.CategorySpeeds is ignored unless overridden by zones.
-- If false, Config.CategorySpeeds are used to define speed limits based on vehicle categories.
Config.EnableMaxSpeed = true

-- Maximum speed in km/h or mph to which vehicles are limited when Config.EnableMaxSpeed is true
Config.MaxSpeed = 200

-- Interval in milliseconds for speed checks
Config.CheckInterval = 100

-- Global reduction time in milliseconds (time to reduce speed to the limit)
Config.ReductionTime = 2000  -- 2 seconds

-- Groups to be ignored (e.g., admins)
Config.IgnoredGroups = {
    enabled = false,
    groups = {
        "admin",
        "superadmin"
    },
    -- Display a message when an ignored player enters a vehicle
    enterMessage = "No speed limit for you! XD"
}

-- Exceptions for specific vehicles (model name -> maximum speed in km/h or mph)
-- These exceptions always apply regardless of Config.EnableMaxSpeed or Config.CategorySpeeds
Config.Exceptions = {
    ["POLICE"] = 150,
    ["AMBULANCE"] = 140,
    ["ITALIRSX"] = 320
}

-- Speed limits by vehicle category (category -> maximum speed in km/h or mph)
-- Used only when Config.EnableMaxSpeed is false or when not in a zone
Config.CategorySpeeds = {
    ["compacts"] = 150,
    ["sedans"] = 160,
    ["suvs"] = 140,
    ["coupes"] = 180,
    ["muscle"] = 170,
    ["sportsclassics"] = 200,
    ["sports"] = 220,
    ["super"] = 250,
    ["motorcycles"] = 200,
    ["offroad"] = 180,
    ["industrial"] = 110,
    ["utility"] = 120,
    ["vans"] = 100,
    ["cycles"] = 50,
    ["boats"] = 80,
    ["helicopters"] = 160,
    ["planes"] = 200,
    ["service"] = 130,
    ["emergency"] = 150,
    ["military"] = 140,
    ["commercial"] = 120,
    ["trains"] = 100
}

-- Notification settings
Config.EnableNotification = true
Config.NotificationEvent = function(message)
    --TriggerEvent("SService:Client:MakeInfoNotify", 'info', 'Speed Limit', message, 5000)
    TriggerEvent('esx:showNotification', 'Speed Limit: ' .. message)
end
Config.NotificationText = 'The speed limit for this vehicle is: '

-- Text display settings for on-screen messages
Config.EnableTextDisplay = true
Config.TextDisplayMessage = 'Speed Limit: '
Config.TextDisplayDuration = 5000  -- Duration in milliseconds
Config.TextDisplayColor = { r = 255, g = 255, b = 255, a = 255 }  -- Text color (RGBA)

-- Zone configuration
Config.Zones = {
    enabled = true,  -- Enable or disable zone functionality
    displayBlips = true,  -- Display blips for zones on the map
    blip = {
        sprite = 161,      -- Blip sprite (adjust as needed)
        color = 2,         -- Blip color
        scale = 0.8,       -- Blip scaling
        shortRange = true  -- Blip visibility in short range
    },
    zoneList = {
        {
            name = "Residential Area",
            coords = vector3(197.1024, -932.1866, 30.6867),
            radius = 150.0,
            speedLimit = 120,
            enterMessage = "You have entered {name}. Speed limit: {speedLimit} km/h..",
            leaveMessage = "You have left the residential area.",
            reductionTime = 2000,
            checkInterval = 100,
            displayColor = { r = 0, g = 255, b = 0, a = 100 }
        },
        -- Add more zones as needed
    }
}

my discord
my Discord

my other works
FiveM Discord Booster
fishing
gas station
pocketbike

|-------------------------------------|----------------------------|
| Code is accessible | No only config
| Subscription-based | No
| Lines (approximately) | >340 lines
| Requirements | ESX/QBCore
| Support | Yes

Config Merger
Have you tried Config Merger? Merge your configs easily