Coder Social home page Coder Social logo

qb-parking's Introduction

QB-Parking

This is a very awesome parking mod, that i specially made for qb-core This is just how you park in real live ๐Ÿ˜ so park anywhere you want ๐Ÿ‘Š๐Ÿ˜๐Ÿ‘ This mod is more intended for large servers, with VIP players, you can give this player an extra feature, to let them park in front of there own house, or you can use this, if you are a youtuber, and you don't want to mesh up and get your scene back togetter again, and getting al your vehicles from garage back on it place, you can also use this mod, so your scene stays how you put it, just a little thing I thought of what you also can do with this mod. ๐Ÿ˜

This mod is also good if players crashes or if the server gets a reboot, and if you have permission to park, and you have parked your vehicle, then you never have to get your vehicle from the garage again, but if you do forget to park your vehicle, your vehicle can be found in garage or impound.

This is my second mod i make public, so please by kind to my ๐Ÿ˜ i still have much to learn.

Read The Updates.md for updates and changes.

๐Ÿ“ธ Screenshot ๐Ÿ‘Š๐Ÿ˜๐Ÿ‘

foto1

๐ŸŽฅ Video ๐Ÿ‘Š๐Ÿ˜๐Ÿ‘

Watch the video1

๐Ÿ’ช Dependencies

๐Ÿ’ช Optional

๐Ÿ™ How to install and do not forget anything, or it will not work, or give many errors.

  • ๐Ÿ‘‰ Step 1: First stop your server. ๐Ÿ˜
  • ๐Ÿ‘‰ Step 2: Copy the directory qb-parking to resources/[qb]/
  • ๐Ÿ‘‰ Step 3: Add the player_parking.sql with 2 tables to your correct database.
  • ๐Ÿ‘‰ Step 4: Add any recommended extra code what I say you should add.
  • ๐Ÿ‘‰ Step 5: If you are 100% sure, you have done all 4 steps correctly, go to step 6.๐Ÿ˜
  • ๐Ÿ‘‰ Step 6: Start your server.
  • ๐Ÿ‘‰ Step 7: Add your self as vip, you can use the command: /park-addvip [id] [amount]
  • ๐Ÿ‘‰ Step 8: Most important step -> Enjoy ๐Ÿ‘Š๐Ÿ˜Ž๐Ÿ‘

๐Ÿ€ Features

  • โœ… Easy to install and use
  • โœ… QB-Phone notifications
  • โœ… Admin Controll like disable or enable the system or set it to only allowed for vip players only.
  • โœ… User Controll like displaying text on screen.
  • โœ… Police can, if thay want, always see who owns the vehicle by using /park-names
  • โœ… Players with user status will only see the model name of this vecihle, not the owners name or plate.
  • โœ… 3D Waypoints is optional to use, uncommand the d3 waypoint in fxmanifest.lua file.
  • ๐Ÿ‘‰ Your players will love this extra feature, if they can park there own vehicle in front of there housees or clubs.
  • ๐Ÿ‘‰ Your players can setup youtube scenes, and if they want, they can come back later, and your vechiles are still there.
  • ๐Ÿ‘‰ This is very usefull cause if you make a scene and somehthing goes wrong, then don't wory you vechiles are right there.
  • ๐Ÿ‘‰ And of course you should not forget to park your vehicle ๐Ÿ‘Š๐Ÿ˜๐Ÿ‘

๐ŸŽฎ How To Use

  • ๐Ÿ‘‰ Typ "/park" to park or drive your vehicle where you are at that moment. (Users and Admins)
  • ๐Ÿ‘‰ Typ "/park-names if you want to display the names ontop of the vehicle that is parked. (Users and Admins)
  • ๐Ÿ‘‰ Typ "/park-notification" to turn on or of the phone notification (Users and Admins)
  • ๐Ÿ‘‰ Typ "/park-system" if you want to turn on or off the system. (Admin Only)
  • ๐Ÿ‘‰ Typ "/park-usevip" to turn on and of the vip system
  • ๐Ÿ‘‰ Typ "/park-addvip [id] [amount]" if you want to add a vip. (Admin Only)
  • ๐Ÿ‘‰ Typ "/park-removevip [id]" if you want to remove a vip. (Admin Only)
  • ๐Ÿ‘‰ If you want to use the F5 button, you must add it to your /binds and add on F5 the word "park"

โš™๏ธ Settings

  • ๐Ÿ‘‰ Change the max cars that can park in the world space, change the amount from Config.Maxcarparking in the config.lua file.
  • ๐Ÿ‘‰ Vip users can be added by command, only if you use the vip option.
  • ๐Ÿ‘‰ Knowledge of programming and use your brains cause i'am not going to help you install this mod, cause it's very easy to do.

๐Ÿ’ฏ What i recommend for using this mod

  • ๐Ÿ‘‰ I recommend to use this mod only for vip players or for players who are most online on you server.
  • ๐Ÿ‘‰ Try not to spawn too many vehicles in world space, this can cause issues and hiccups.
  • ๐Ÿ‘‰ It is also recommended to have a good computer/server to use this mod, cause you will need it.
  • ๐Ÿ‘‰ To keep the server nice and clean for everyody, use this system only for vip players.

๐Ÿ’ฏ I tested this mod on a computer/server with the following settings

  • โœ… Prossessor: I7 12xCore
  • โœ… Memory: 16 gig memory
  • โœ… Graphics: GTX 1050 TI 4GB

๐Ÿ™ Don't do this...

  • ๐Ÿ‘‰ DO NOT park your vehicles on roofs or that kind of stuff, just don't do it, it will work, but it breaks the mod,
  • ๐Ÿ‘‰ use the recommended parking spots in the world like you do in real life,
  • ๐Ÿ‘‰ you can do of course just park at your own house on a parking spot to keep it nice and clean for everyone.

๐Ÿ’ฏ Police and Mechanic Impound Trigger

  • โœ… You can impound this vehicles, if a user park their vehicle incorrectly, and you added the trigger correctly...
  • โœ… You can give a fine, and then if you want, you can still impound this vehicle.
  • โœ… If a player as police, if they can enable the hud to see the name and plate of this persons parked vehicle, by using /park-names.
  • โœ… The Polices and Mechanics client side trigger event, for the police or mechanic to impount a vehicle correctly.
  • โœ… You MUST add this to your police impound trigger event.

๐Ÿ‘‡ Extra Code in resources/[qb]/qb-vehiclekeys/client/main.lua.

RegisterNetEvent('vehiclekeys:client:SetVehicleOwnerToCitizenid', function(plate, citizenid)
    TriggerServerEvent('vehiclekeys:server:SetVehicleOwnerToCitizenid', plate, citizenid)
end)

๐Ÿ‘‡ Extra Code in resources/[qb]/qb-vehiclekeys/server/main.lua.

RegisterNetEvent('vehiclekeys:server:SetVehicleOwnerToCitizenid', function(plate, citizenid)
    if VehicleList then
        local val = VehicleList[plate]
        if val then
            VehicleList[plate].owners[citizenid] = true
        else
            VehicleList[plate] = { owners = {} }
            VehicleList[plate].owners[citizenid] = true
        end
    else
        VehicleList = {}
        VehicleList[plate] = { owners = {} }
        VehicleList[plate].owners[citizenid] = true
    end
end)

๐Ÿ‘‡ To keep things nice and clean for the qb-core system and database.

  • โœ… Go to resources[qb]/qb-core/server/player.lua around line 506, and find, local playertables = {}.
  • โœ… This is, if we want to delete a character, we also want to delete the parked vehicles in the database,
  • โœ… Place the line below at the bottom in playertables (there are more insite), so place this one at the bottom.
{ table = 'player_parking' },

Stolen Trigger, when the vehicle gets stolen by a other player with picklock

  • Added below -> TriggerEvent("qb-parking:client:stolen", lockpickedPlate)
-- resources/[qb]/qb-vehiclekeys/client.lua line 165 change it with this code.
local function lockpickFinish(success)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local vehicle = QBCore.Functions.GetClosestVehicle(pos)
    local chance = math.random()
    if success then
        TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
        QBCore.Functions.Notify('Opened Door!', 'success')
        SetVehicleDoorsLocked(vehicle, 1)
        lockpicked = true
        lockpickedPlate = QBCore.Functions.GetPlate(vehicle)
        TriggerEvent("qb-parking:client:stolen", lockpickedPlate) -- <---------------- HERE !!!
    else
        PoliceCall()
        TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
        QBCore.Functions.Notify('Someone Called The Police!', 'error')
    end
    if usingAdvanced then
        if chance <= Config.RemoveLockpickAdvanced then
            TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items["advancedlockpick"], "remove")
            TriggerServerEvent("QBCore:Server:RemoveItem", "advancedlockpick", 1)
        end
    else
        if chance <= Config.RemoveLockpickNormal then
            TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items["lockpick"], "remove")
            TriggerServerEvent("QBCore:Server:RemoveItem", "lockpick", 1)
        end
    end
end

Impound Trigger, to unpark the vehicle.

 TriggerEvent("qb-parking:client:impound", plate) 

๐Ÿ‘ฎโ€โ™‚๏ธ Impound trigger

  • Go to resources[qb]\qb-policejob\client\job.lua line 332
  • Find ๐Ÿ‘‡
RegisterNetEvent('police:client:ImpoundVehicle', function(fullImpound, price)
    local vehicle = QBCore.Functions.GetClosestVehicle()
    local bodyDamage = math.ceil(GetVehicleBodyHealth(vehicle))
    local engineDamage = math.ceil(GetVehicleEngineHealth(vehicle))
    local totalFuel = exports['LegacyFuel']:GetFuel(vehicle)
    if vehicle ~= 0 and vehicle then
        local ped = PlayerPedId()
        local pos = GetEntityCoords(ped)
        local vehpos = GetEntityCoords(vehicle)
        if #(pos - vehpos) < 5.0 and not IsPedInAnyVehicle(ped) then
            local plate = QBCore.Functions.GetPlate(vehicle)
            TriggerServerEvent("police:server:Impound", plate, fullImpound, price, bodyDamage, engineDamage, totalFuel)
            QBCore.Functions.DeleteVehicle(vehicle)
        end
    end
end)
  • Replace ๐Ÿ‘‡
RegisterNetEvent('police:client:ImpoundVehicle', function(fullImpound, price)
    local vehicle = QBCore.Functions.GetClosestVehicle()
    local bodyDamage = math.ceil(GetVehicleBodyHealth(vehicle))
    local engineDamage = math.ceil(GetVehicleEngineHealth(vehicle))
    local totalFuel = exports['LegacyFuel']:GetFuel(vehicle)
    if vehicle ~= 0 and vehicle then
        local ped = PlayerPedId()
        local pos = GetEntityCoords(ped)
        local vehpos = GetEntityCoords(vehicle)
        if #(pos - vehpos) < 5.0 and not IsPedInAnyVehicle(ped) then
            local plate = QBCore.Functions.GetPlate(vehicle)
            TriggerEvent('qb-parking:client:impound', plate) -- <--- impound qb-parking trigger
            TriggerServerEvent("police:server:Impound", plate, fullImpound, price, bodyDamage, engineDamage, totalFuel)
            QBCore.Functions.DeleteVehicle(vehicle)
        end
    end
end)

Unpark Trigger, to unpark the vehicle, just for other garages scripts.

 TriggerEvent("qb-parking:client:unpark", plate) 

โš™๏ธ Database Table

CREATE TABLE `player_parking`  (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `citizenname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `plate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `fuel` int(15) NOT NULL DEFAULT 0,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `time` bigint(20) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `player_parking_vips` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `citizenname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `maxparking` int(5) NOT NULL DEFAULT 0,
  `hasparked` int(5) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

โš™๏ธ To get a other languages.

  • 1: copy a file from the resources[qb]/qb-parking/locales directory
  • 2: rename this file for example fr.lua or sp.lua
  • 3: translate the lines in the file to your language
  • 4: you now have added a new language to the system, enjoy ๐Ÿ˜Ž

๐Ÿž Any bugs issues or suggestions, let my know.

  • If you have any suggestions or nice ideas let me know and we can see what we can do ๐Ÿ‘Š๐Ÿ˜Ž
  • Keep it nice and clean for everybody and have fun with this awesome qb-parking mod ๐Ÿ˜Ž๐Ÿ‘

๐Ÿ™ˆ Youtube & Discord & Twitter

qb-parking's People

Contributors

madhouse79 avatar nemadev avatar mulgirtab avatar berkiebb avatar

Stargazers

 avatar rpRIGGS avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.