Code Monkey home page Code Monkey logo

mh-parking's Introduction

Hi ๐Ÿ‘‹, I'm MaDHouSe

A passionate allround developer

My Youtube Channel and Discord

mh-parking

  • An Advanced Parking System build by MaDHouSe79.
  • when you park, befor you hit F5 turn your steel and lock it at that position when parked.

subscribe to my channel It helps the channel grow Youtube

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

Watch the video1 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 mh-parking to resources/[mh]/
  • ๐Ÿ‘‰ Step 3: Read this file! (the database will install automaticly)
  • ๐Ÿ‘‰ Step 4: Start your server.
  • ๐Ÿ‘‰ Step 5: Add your self or other as vip, you can use the command: /park-addvip [id]
  • ๐Ÿ‘‰ Step 6: Most important step -> Enjoy ๐Ÿ‘Š๐Ÿ˜Ž๐Ÿ‘

๐ŸŽฎ Commands

  • ๐Ÿ‘‰ 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-lotnames if you want to display the names of the parking lots. (Users and Admins)
  • ๐Ÿ‘‰ Typ "/park-cmenu" to create a new parking space (Admin only)
  • ๐Ÿ‘‰ Typ "/park-bmode" to go in to build mode (Admin only)
  • ๐Ÿ‘‰ 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]" 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"

๐Ÿ‘‰ NOTE DONT FORGET TO ADD YOUR SELF AS VIP

๐Ÿ’ฏ 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

Unpark trigger event (use this server side)

  • this only unpark the vehicle, it does not delete the entity from the gameworld.
  • use this trigger in qb-policejob/server/main.lua, replace it with this (around line 888)
RegisterNetEvent('police:server:Impound', function(plate, fullImpound, price, body, engine, fuel)
    local src = source
    price = price and price or 0
    if IsVehicleOwned(plate) then
        TriggerEvent('mh-parking:server:unpark', plate) -- <----- OR ADD THIS TRIGGER HERE (mh-parking)
        if not fullImpound then
            MySQL.query('UPDATE player_vehicles SET state = ?, depotprice = ?, body = ?, engine = ?, fuel = ? WHERE plate = ?', {0, price, body, engine, fuel, plate})
            TriggerClientEvent('QBCore:Notify', src, Lang:t("info.vehicle_taken_depot", {price = price}))
        else
            MySQL.query(
                'UPDATE player_vehicles SET state = ?, body = ?, engine = ?, fuel = ? WHERE plate = ?',
                {2, body, engine, fuel, plate})
            TriggerClientEvent('QBCore:Notify', src, Lang:t("info.vehicle_seized"))
        end
    end
end)

Optional qb-garages integration, this part is also for the phone app

  • you need to find this in your qb-garages server and client file
if v.state == 0 then
    v.state = Lang:t("status.out")
elseif v.state == 1 then
    v.state = Lang:t("status.garaged")
elseif v.state == 2 then
    v.state = Lang:t("status.impound")
end

Example qb-garages integration, this part is also for the phone app

  • you need to add a state 3
if v.state == 0 then
    v.state = Lang:t("status.out")
elseif v.state == 1 then
    v.state = Lang:t("status.garaged")
elseif v.state == 2 then
    v.state = Lang:t("status.impound")
elseif v.state == 3 then                 -- <--- ADD HERE
    v.state = "Parked outside"
end
  • if you get this error
  • script:qb-core] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:741: SCRIPT ERROR: @qb-phone/server/main.lua:233: attempt to index a nil value (field 'Garages')

Check the config file from qb-phone

  • check if you have this
Config.Garages = Garages

๐Ÿ‘‡ 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' },
{ table = 'player_parking_vips' },

Contributers

๐Ÿ˜Ž Special thanks for helping me with testing ๐Ÿ‘Š๐Ÿ˜‰๐Ÿ‘

  • ๐Ÿ’ช GUS
  • ๐Ÿ’ช Jazerra
  • ๐Ÿ’ช ameN
  • ๐Ÿ’ช MulGirtab
  • ๐Ÿ’ช DannyJ
  • ๐Ÿ’ช MasonJason310
  • ๐Ÿ’ช Enxsistanz
  • ๐Ÿ’ช !ExiledVibe!
  • ๐Ÿ’ช FARRUKO

LICENSE

GPL LICENSE
ยฉ MaDHouSe79

mh-parking's People

Contributors

berkiebb avatar madhouse79 avatar mulgirtab avatar nemadev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mh-parking's Issues

Vehicle Being Removed

Hello,

Up to this moment, we are still utilizing this amazing script.
I didn't activate VIP, literally everyone can park anywhere.
No one's getting any errors related to this script.

There's just one thing I would like to know if possible.
How do I make it so the car, if left unparked won't automatically disappear.
I mean there are instances where a player automatically gets disconnected while driving due to some random issues like intermittent connection or maybe kicked by the anti-cheat. The vehicle would actually disappear. Maybe I can put a Wait(time) before it is removed?

Hope this is possible, thanks...

Drive

When i park the car with F5 then enter the car and turning it on i can drive away without pressing f5 i can then press f5 anytime to return to that park position.

Warning...

image

With every press of F5 this happens

image

In addition to activating only two cars that do not work

Some vehicles dissapears after parking

They dissapear cause they don't have a modelname in the database. How can i solve it? They are all configured by the same way in qb-core/shared/vehicles.lua

heidisql_UJHfW3NkdG

issue or works like that?

When i park the vehicle, the car is freezed and i need to hit F5 to unfreeze, thats ok, but if i disconnect and join the server again, i can drive the car without hit F5.

Its that suppose to happen?

Cars spawn on top of eachother.

I don't use the premade spots, so players can park where they want.

And when i park a car or they render in, 3 spawn on top of eachother..

Suggestion

I was wondering if it could be possible to add a feature where other players and steal parked cars even if that player is offline but it will send a notification to all police officers that are in the server on and off duty when the car theft happens. Also have the ability for players to store the stolen vehicle in a garage. Also i would suggest to make it where it can easily be turn on or off if other servers doesn't want that on

[Question/Help] SQL Errors the day after it working fine

[Question/Help]

After using this in my test server perfectly, Multiple restarts with no errors and was working awesome, I moved it into my live server. I made sure to enter my SQL and I am now getting the errors below today.

I then went into my test server to see if there had been a change there and yes, It also was not working? I had not touched anything as once I got this working I called it a night. So I am very confused on what to do or what has happened

(node:137) UnhandledPromiseRejectionWarning: Error: mh-parking was unable to execute a query!
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS player_parking_vips (
id int(10) N...' at line 22
CREATE TABLE IF NOT EXISTS player_parking (
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,
model varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
modelname varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
plate varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
steerangle int(15) NOT NULL DEFAULT 0,
fuel int(15) NOT NULL DEFAULT 0,
engine int(15) NOT NULL DEFAULT 0,
body int(15) NOT NULL DEFAULT 0,
oil int(15) NOT NULL DEFAULT 0,
data longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
coords longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
time bigint(20) NOT NULL,
cost int(10) NOT NULL DEFAULT 0,
parktime int(10) NOT NULL DEFAULT 0,
parking varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (id) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=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(10) NOT NULL DEFAULT 0,
        `hasparked` int(10) NOT NULL DEFAULT 0,
        PRIMARY KEY (`id`) USING BTREE
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
     []
at @oxmysql/dist/build.js:22275:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

(node:137) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 17)

I have not ran into any errors like this before so I am just looking for some suggestions or help.

Vehicle Duplication

if there are 2 or more people in the vehicle, then the vehicles were duplicated at the time of parking

Feature

Will be cool if you can add parking slots limit for vip, so they cant park lot of vehicles just for fun.

[Enhancement] ParkedViewDistance

Great script here, frankly speaking.
Curious though. would there be any chance in the future that the Config.ParkedViewDistance will have an actual function?
Thanks!

inventory

After server restart you can open the trunk and glovebox inventory of all cars even if they are not owned

Quick idea

Why not make mh-parking save the last parking location of the car without having to press F5?
The idea was copied from MojiaGarages

Not a string error

When I try to add me as VIP, there comes the error that the object is not a string

server/main.lua 16

any way to fix this?

Update needed

Hello this script on server load doesn't let players 3rd eye their cars unless you manually restart the script...... please fix as i really want to use this

Hello Madhouse can you help me? About fivem mh-parking?

I am a strict follower of yours. But I need help with something. I downloaded the "mh-parking" and "mh-vehiclekeys" posts you shared. However, when I want to park my car, it gives the error I mentioned in the pictures. And the vehicle spawns locked. But I cannot get into the vehicle at all. When I press the L button, it gives the warning "Vehicle is unlocked" repeatedly. It doesn't say "vehicle locked".
(But actually the vehicle is locked and cannot be unlocked)

I pointed out the errors in the pictures. Would you be helping me in this regard? Thank you from now.
If you can spare your valuable time for me, I would like to pay you your fee within my means. This is very important for me.

Note: I checked all the settings in the config file. I don't think there is anything wrong. Even though I have /park-addvip permission, unfortunately it did not solve my problem.

At the same time, when I open the "Debug console" setting, it gives this error.
Screenshot_3
Screenshot_4
Screenshot_6

Ediet fxmanifest.lua

image

fx_version 'cerulean'
games { 'gta5' }

author 'MaDHouSe'
description 'QB Realistic Vehicle Parking'
version '2.0'

ui_page 'html/index.html'

files {
	'html/*.html',
	'html/*.js',
	'html/*.css',
}

shared_scripts {
    '@qb-core/shared/locale.lua',
    '@qb-core/shared/vehicles.lua',
    'locales/en.lua', -- change en to your language
    'config.lua',
    'configs/*.lua',
}

client_scripts {
    'client/main.lua',
}

server_scripts {
    '@oxmysql/lib/MySQL.lua',
    'server/main.lua',
}

dependencies {
    'oxmysql',
    'qb-core',
}

lua54 'yes'

Lat public park used as impound

Car uses last public parking space as impound.
When using public garage and then taking car out for drive, then logging off, instead of hayes impound receiving car at login, the last public car parking lot is where car appears.
If a garage is used, then car remains in garage, however leaving car out on street results in last public car park receiving car, opposed to impound that should receive car
Not sure if this has been fixed by latest commits, was occurring prior to fixes

PlayerOnLoad loading of vehicles.

Hey, I've been using this awesome script. Had to put some changes in it to meet our requirements and everything is perfect! Got no issues except for some random times where cars get duplicated for some weird reason but this isn't the reason why I'm writing.

I just wanted to know if there's a way to make it so vehicles load faster on player load. As of current, script loads 2 cars at a time. If there's a way to increase it would be really cool.

Thanks! :D

issue i think

image
can you give me the sql from player_boats, like when i try to park my car i get this

Motorcycles disappear

After /park'ing a sanchez the vehicle disappears and never returns. Everything looks fine in the database

image

added de.lua German Language

local Translations = {
error = {
["citizenid_error"] = "[ERROR] Bรผrger-ID des Spielers konnte nicht abgerufen werden!",
["mis_id"] = "[Error] Eine Spieler-ID ist erforderlich.",
["mis_amount"] = "[Error] Es gibt keine Anzahl von Fahrzeugen, die dieser Spieler parken kann.",
},
commands = {
["addvip"] = "Hinzufรผgen",
["removevip"] = "Entfernen",
},
system = {
['enable'] = "Das Parksystem %{type} ist jetzt aktiviert",
["disable"] = "Das Parksystem %{type} ist jetzt deaktiviert",
["freeforall"] = "Parksystem: ist jetzt fรผr alle Spieler aktiviert.",
["parkvip"] = "Parksystem: ist jetzt nur fรผr VIP aktiviert.",
["no_permission"] = "Parksystem: Sie haben keine Parkberechtigung.",
["offline"] = "Parksystem ist offline",
["update_needed"] = "Parksystem ist veraltet....",
["already_vip"] = "Spieler ist bereits ein VIP!",
["vip_not_found"] = "Spieler nicht gefunden!",
["vip_add"] = "Spieler %{username} wird als VIP hinzugefรผgt!",
["vip_remove"] = "Player %{username} is removed as vip!",
["max_allow_reached"] = "Die maximale Anzahl an gepackten Fahrzeugen fรผr Sie betrรคgt %{max}",
["park_or_drive"] = "Parken oder fahren",
},
success = {
["parked"] = "Ihr Auto ist gepackt",
["route_has_been_set"] = "Es ist ein Wegpunkt auf der Karte, der auf der Karte angezeigt wird.",
},
info = {
["companyName"] = "Beunhaas BV",
["owner"] = "Inhaber: y%{owner}s",
["plate"] = "Kennzeichen: g%{plate}s",
["model"] = "b%{model}s",
["press_drive_car"] = "Drรผcken Sie F5, um mit dem Fahren zu beginnen",
["car_already_parked"] = "Ein Fahrzeug mit dem gleichen Kennzeichen hat bereits geparkt",
["car_not_found"] = "Kein Fahrzeug gefunden",
["maximum_cars"] = "Es kรถnnen maximal r%{value}s Autos drauรŸen auf der StraรŸe geparkt werden, und das Limit ist erreicht, du musst dieses Fahrzeug im Parkhaus parken!",
["must_own_car"] = "Sie mรผssen das Auto besitzen, um es zu parken.",
["has_take_the_car"] = "Ihr Fahrzeug wurde aus der Parkzone entfernt",
["only_cars_allowd"] = "Hier kรถnnen Sie nur Autos parken",
["stop_car"] = "Halten Sie Ihr Fahrzeug an, bevor Sie parken",
["police_info"] = "rPolizeis Fahrzeuginfo\n",
["citizen_info"] = "gBรผrgers Fahrzeuginfo\n",
},
mail = {
["sender"] = "%{company}",
["subject"] = "Geparkt %{model}",
["message"] = "Hey, %{username}

Vielen Dank fรผr Ihr Vertrauen in unseren Parkplatz!

Damit Sie nicht vergessen, wo Sie Ihr Auto geparkt haben.
Sie erhalten auรŸerdem eine Erinnerungs-E-Mail mit Kennzeichen und Standort Sie haben Ihr Auto ungefรคhr geparkt

Besitzer: %{username}
Modell: %{model}
Kennzeichen: %{plate}
Ort: %{street}< br />

%{company}",
}

Lang = Locale:new({
phrases = Translations,
warnOnMissing = true
})

Keys/Blip

Hello MadHouse, I would like to inform you a on a issue. I testing this best of my ability. When a car it parked and server has restarted you dont have keys and the blip is no longer on map. I can unpark the car with third eye. I have to lockpick the car to get in. Once locked picked I can repark the car.

Have no error client side or server side.

Edit: Also have to hotwire car.

keys not working

i added the extra codes but it didnt work i still cant access it once parked unless i 3rd eye

Pessanger

When we try park with someone in the pessenger seat. It duplicates car and makes other one fly away.

Fuel

i have problem with fuel its not saving the fuel state
in qb-garages it works fine
i use the latest Qbcore
latest LegacyFuel

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.