From 37976edc2244514b9c096b0a4858fefbf76cb9f1 Mon Sep 17 00:00:00 2001 From: Kakarot <57848836+GhzGarage@users.noreply.github.com> Date: Wed, 8 Nov 2023 04:40:47 -0600 Subject: [PATCH] Util commands Delete all vehicles, peds or objects known to the server --- locale/en.lua | 45 ++++++++++++++++++++++++--------------------- server/commands.lua | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 21 deletions(-) diff --git a/locale/en.lua b/locale/en.lua index f5d80a7..a03be6c 100644 --- a/locale/en.lua +++ b/locale/en.lua @@ -1,23 +1,23 @@ local Translations = { error = { - not_online = 'Player not online', - wrong_format = 'Incorrect format', - missing_args = 'Not every argument has been entered (x, y, z)', - missing_args2 = 'All arguments must be filled out!', - no_access = 'No access to this command', - company_too_poor = 'Your employer is broke', - item_not_exist = 'Item does not exist', - too_heavy = 'Inventory too full', - location_not_exist = 'Location does not exist', - duplicate_license = '[QBCORE] - Duplicate Rockstar License Found', - no_valid_license = '[QBCORE] - No Valid Rockstar License Found', - not_whitelisted = '[QBCORE] - You\'re not whitelisted for this server', - server_already_open = 'The server is already open', - server_already_closed = 'The server is already closed', - no_permission = 'You don\'t have permissions for this..', - no_waypoint = 'No Waypoint Set.', - tp_error = 'Error While Teleporting.', - connecting_database_error = '[QBCORE] - A database error occurred while connecting to the server. (Is the SQL server on?)', + not_online = 'Player not online', + wrong_format = 'Incorrect format', + missing_args = 'Not every argument has been entered (x, y, z)', + missing_args2 = 'All arguments must be filled out!', + no_access = 'No access to this command', + company_too_poor = 'Your employer is broke', + item_not_exist = 'Item does not exist', + too_heavy = 'Inventory too full', + location_not_exist = 'Location does not exist', + duplicate_license = '[QBCORE] - Duplicate Rockstar License Found', + no_valid_license = '[QBCORE] - No Valid Rockstar License Found', + not_whitelisted = '[QBCORE] - You\'re not whitelisted for this server', + server_already_open = 'The server is already open', + server_already_closed = 'The server is already closed', + no_permission = 'You don\'t have permissions for this..', + no_waypoint = 'No Waypoint Set.', + tp_error = 'Error While Teleporting.', + connecting_database_error = '[QBCORE] - A database error occurred while connecting to the server. (Is the SQL server on?)', connecting_database_timeout = '[QBCORE] - Connection to database timed out. (Is the SQL server on?)', }, success = { @@ -41,9 +41,9 @@ local Translations = { tp = { help = 'TP To Player or Coords (Admin Only)', params = { - x = { name = 'id/x', help = 'ID of player or X position'}, - y = { name = 'y', help = 'Y position'}, - z = { name = 'z', help = 'Z position'}, + x = { name = 'id/x', help = 'ID of player or X position' }, + y = { name = 'y', help = 'Y position' }, + z = { name = 'z', help = 'Z position' }, }, }, tpm = { help = 'TP To Marker (Admin Only)' }, @@ -76,6 +76,9 @@ local Translations = { }, }, dv = { help = 'Delete Vehicle (Admin Only)' }, + dvall = { help = 'Delete All Vehicles (Admin Only)' }, + dvp = { help = 'Delete All Peds (Admin Only)' }, + dvo = { help = 'Delete All Objects (Admin Only)' }, givemoney = { help = 'Give A Player Money (Admin Only)', params = { diff --git a/server/commands.lua b/server/commands.lua index 6c336c6..c9e30dc 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -191,6 +191,31 @@ QBCore.Commands.Add('dv', Lang:t('command.dv.help'), {}, false, function(source) TriggerClientEvent('QBCore:Command:DeleteVehicle', source) end, 'admin') +QBCore.Commands.Add('dvall', Lang:t('command.dvall.help'), {}, false, function(source) + local vehicles = GetAllVehicles() + for _, vehicle in ipairs(vehicles) do + DeleteEntity(vehicle) + end +end, 'admin') + +-- Peds + +QBCore.Commands.Add('dvp', Lang:t('command.dvp.help'), {}, false, function(source) + local peds = GetAllPeds() + for _, ped in ipairs(peds) do + DeleteEntity(ped) + end +end, 'admin') + +-- Objects + +QBCore.Commands.Add('dvo', Lang:t('command.dvo.help'), {}, false, function(source) + local objects = GetAllObjects() + for _, object in ipairs(objects) do + DeleteEntity(object) + end +end, 'admin') + -- Money QBCore.Commands.Add('givemoney', Lang:t('command.givemoney.help'), { { name = Lang:t('command.givemoney.params.id.name'), help = Lang:t('command.givemoney.params.id.help') }, { name = Lang:t('command.givemoney.params.moneytype.name'), help = Lang:t('command.givemoney.params.moneytype.help') }, { name = Lang:t('command.givemoney.params.amount.name'), help = Lang:t('command.givemoney.params.amount.help') } }, true, function(source, args)