[Release][ESX] Give or delete owned vehicle to database (plate can custom or random generate)

Description:

This plugin you can give vehicle with custom or random plate number into player’s garage with command, also you can delete a vehicle by plate number

image

Commands:

In game: (give permission in config)

Give a car to the target player: /givecar [playerID] [vehicle] <plate>
Give a plane to the target player: /giveplane [playerID] [vehicle] <plate>
Give a boat to the target player: /giveboat [playerID] [vehicle] <plate>
Give a helicopter to the target player: /giveheli [playerID] [vehicle] <plate>
Note: If plate is none will randomly generate a new plate

Delete a owned car by plate: /delcarplate [plate]

On console: (prefix need change to “_”)

_givecar [playerID] [car] <plate>
_giveplane [playerID] [car] <plate>
_giveboat [playerID] [car] <plate>
_giveheli [playerID] [car] <plate>
_delcarplate [plate]

Config:

Config = {}
Config.Locale = 'en'

Config.ReceiveMsg = true

-- Allow below identifier player to execute commands
Config.AuthorizedRanks = {
  'superadmin',
--  'admin'
}

Images:

image

Notifications

擷取
image
image

Update

2020/8/28

  • Now you can custom a plate with “space”
  • Better command syntax

2020/11/6

  • No essentialmode required anymore
  • Give command permission in config

2021/1/10

  • Merged @Myself5’s fork, thanks him
  • Abstract the current givecar to givevehicle
  • Add givecar, giveboat, giveplane and giveheli to pass type to the database
  • Rework Permission requests to limits by group, you can add group in config

Requirements

Download

esx_givevehicle

If helped you please leave give me a like :heart:

48 Likes

just admin can do that?

sure, if you are admin or superadmin in user group database can do this

1 Like

how can i limit the use to superadmin only?

1 Like

go to server.lua and search this
TriggerEvent('es:addGroupCommand', 'givecar', 'admin', function(source, args, user)
change to this
TriggerEvent('es:addGroupCommand', 'givecar', 'superadmin', function(source, args, user)

Done :smiley:

3 Likes

I love this script :slight_smile: Thanks for sharing! :+1:

1 Like

Of course. I’m an idiot. hahahaha

1 Like

how do you make it work for addon cars ?

Use the spawn name inside the stream folder.
Screenshot_644

doesnt work already tried , tells me that there is no such car

is the addon car can using command to spawn?
if can, won’t have this problem

With me works with all addons. When I execute the command, I am informed that there is no car but 1 second later the license plate is generated and the car is parked. It was never a problem.

ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stored)
how to fix this ?

nice script! just one problem… when i give a car it says its stored in garage… but no car is in garage? any help on this please

2 Likes

just only one car or each car happens?

did you ever fix this?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stored) getting then when trying to give someone a car?

check owned_vehicles in your data base dose the “stored” presence?

yes its there

i can buy cars from the dealership no problem when i try and do it this way, i get this error