-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lots of changes and fixes cleanup too #27
Changes from all commits
a30eb00
eb2c4db
43947be
7e9e364
b9ac86a
d432146
6b2b12a
3630988
8935202
05491ce
a12298e
5424c51
1be50ba
a8be369
54e3237
c64e915
eaed172
a531e12
b7f470d
d10095d
72823ac
1588ea9
ffdab2b
3be54d6
c888c87
fd220b3
26ada48
77c8552
a660296
51e8708
abb3f7e
ff0eabc
4ccae11
1c291f6
d2e3aac
a31bef7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,31 @@ RegisterNetEvent('qb-admin:server:changeplayerdata', function(Selected, Selected | |
PlayerDataOptions[Selected](Target, Input) | ||
end) | ||
|
||
RegisterNetEvent('qb-admin:server:SaveCar', function(mods, vehicle, plate) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should call https://qbox-project.github.io/resources/core/functions/server#spawnvehicle. It should not be calling the database directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i will do all thing what u said |
||
local Player = exports.qbx_core:GetPlayer(source) | ||
local result = MySQL.Sync.fetchAll('SELECT plate FROM player_vehicles WHERE plate = ?', { plate }) | ||
if result[1] ~= nil then | ||
TriggerClientEvent('ox_lib:notify', source, Lang:t("error.failed_vehicle_owner"), 'error', 3000) | ||
return | ||
end | ||
if not exports.qbx_core:HasPermission(source, Config.Events['savecar']) then NoPerms(source) return end | ||
local playerName = GetPlayerName(source) | ||
local citizenID = Player.PlayerData.citizenid | ||
TriggerEvent('qb-log:server:CreateLog', 'admin', 'Admin menu', 'pink', string.format( | ||
"**%s** (CitizenID: %s | ID: %s) - Saved a car to their garage **%s**", | ||
playerName, citizenID, source, vehicle.model | ||
)) | ||
MySQL.Async.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, state) VALUES (?, ?, ?, ?, ?, ?, ?)', { | ||
Player.PlayerData.license, | ||
citizenID, | ||
vehicle.model, | ||
vehicle.hash, | ||
json.encode(mods), | ||
plate, | ||
0 | ||
}) | ||
TriggerClientEvent('ox_lib:notify', source, Lang:t("success.success_vehicle_owner"), 'success', 5000) | ||
end) | ||
RegisterNetEvent('qb-admin:server:giveallweapons', function(Weapontype, PlayerID) | ||
local src = PlayerID or source | ||
local Target = exports.qbx_core:GetPlayer(src) | ||
|
@@ -250,4 +275,4 @@ CreateThread(function() | |
sounds[#sounds + 1] = filename:match('(.+)%..+$') | ||
end | ||
end | ||
end) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be a client event. Can't the spawning and configuration of the car largely be handled server side? Is this command even useful? Admins can already do /car [model] after all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its saves the car / give owership of veh/car