diff --git a/client/events.lua b/client/events.lua index 16b31fa..ae013fd 100644 --- a/client/events.lua +++ b/client/events.lua @@ -1,17 +1,17 @@ -- Variables local blockedPeds = { - "mp_m_freemode_01", - "mp_f_freemode_01", - "tony", - "g_m_m_chigoon_02_m", - "u_m_m_jesus_01", - "a_m_y_stbla_m", - "ig_terry_m", - "a_m_m_ktown_m", - "a_m_y_skater_m", - "u_m_y_coop", - "ig_car3guy1_m", + 'mp_m_freemode_01', + 'mp_f_freemode_01', + 'tony', + 'g_m_m_chigoon_02_m', + 'u_m_m_jesus_01', + 'a_m_y_stbla_m', + 'ig_terry_m', + 'a_m_m_ktown_m', + 'a_m_y_skater_m', + 'u_m_y_coop', + 'ig_car3guy1_m', } local lastSpectateCoord = nil @@ -20,7 +20,7 @@ local isSpectating = false -- Events RegisterNetEvent('qb-admin:client:inventory', function(targetPed) - TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", targetPed) + TriggerServerEvent('inventory:server:OpenInventory', 'otherplayer', targetPed) end) RegisterNetEvent('qb-admin:client:spectate', function(targetPed) @@ -29,21 +29,21 @@ RegisterNetEvent('qb-admin:client:spectate', function(targetPed) local target = GetPlayerPed(targetplayer) if not isSpectating then isSpectating = true - SetEntityVisible(myPed, false) -- Set invisible - SetEntityCollision(myPed, false, false) -- Set collision - SetEntityInvincible(myPed, true) -- Set invincible + SetEntityVisible(myPed, false) -- Set invisible + SetEntityCollision(myPed, false, false) -- Set collision + SetEntityInvincible(myPed, true) -- Set invincible NetworkSetEntityInvisibleToNetwork(myPed, true) -- Set invisibility - lastSpectateCoord = GetEntityCoords(myPed) -- save my last coords - NetworkSetInSpectatorMode(true, target) -- Enter Spectate Mode + lastSpectateCoord = GetEntityCoords(myPed) -- save my last coords + NetworkSetInSpectatorMode(true, target) -- Enter Spectate Mode else isSpectating = false - NetworkSetInSpectatorMode(false, target) -- Remove From Spectate Mode + NetworkSetInSpectatorMode(false, target) -- Remove From Spectate Mode NetworkSetEntityInvisibleToNetwork(myPed, false) -- Set Visible - SetEntityCollision(myPed, true, true) -- Set collision - SetEntityCoords(myPed, lastSpectateCoord) -- Return Me To My Coords - SetEntityVisible(myPed, true) -- Remove invisible - SetEntityInvincible(myPed, false) -- Remove godmode - lastSpectateCoord = nil -- Reset Last Saved Coords + SetEntityCollision(myPed, true, true) -- Set collision + SetEntityCoords(myPed, lastSpectateCoord) -- Return Me To My Coords + SetEntityVisible(myPed, true) -- Remove invisible + SetEntityInvincible(myPed, false) -- Remove godmode + lastSpectateCoord = nil -- Reset Last Saved Coords end end) @@ -52,11 +52,11 @@ RegisterNetEvent('qb-admin:client:SendReport', function(name, src, msg) end) local function getVehicleFromVehList(hash) - for _, v in pairs(QBCore.Shared.Vehicles) do - if hash == v.hash then - return v.model - end - end + for _, v in pairs(QBCore.Shared.Vehicles) do + if hash == v.hash then + return v.model + end + end end @@ -73,17 +73,17 @@ RegisterNetEvent('qb-admin:client:SaveCar', function() if QBCore.Shared.Vehicles[vehname] ~= nil and next(QBCore.Shared.Vehicles[vehname]) ~= nil then TriggerServerEvent('qb-admin:server:SaveCar', props, QBCore.Shared.Vehicles[vehname], GetHashKey(veh), plate) else - QBCore.Functions.Notify(Lang:t("error.no_store_vehicle_garage"), 'error') + QBCore.Functions.Notify(Lang:t('error.no_store_vehicle_garage'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.no_vehicle"), 'error') + QBCore.Functions.Notify(Lang:t('error.no_vehicle'), 'error') end end) local function LoadPlayerModel(skin) RequestModel(skin) while not HasModelLoaded(skin) do - Wait(0) + Wait(0) end end @@ -110,14 +110,14 @@ RegisterNetEvent('qb-admin:client:SetModel', function(skin) SetPedRandomComponentVariation(ped, true) end - SetModelAsNoLongerNeeded(model) - end - SetEntityInvincible(ped, false) + SetModelAsNoLongerNeeded(model) + end + SetEntityInvincible(ped, false) end) RegisterNetEvent('qb-admin:client:SetSpeed', function(speed) local ped = PlayerId() - if speed == "fast" then + if speed == 'fast' then SetRunSprintMultiplierForPlayer(ped, 1.49) SetSwimMultiplierForPlayer(ped, 1.49) else @@ -126,23 +126,6 @@ RegisterNetEvent('qb-admin:client:SetSpeed', function(speed) end end) -RegisterNetEvent('qb-weapons:client:SetWeaponAmmoManual', function(weapon, ammo) - local ped = PlayerPedId() - if weapon ~= "current" then - weapon = weapon:upper() - SetPedAmmo(ped, GetHashKey(weapon), ammo) - QBCore.Functions.Notify(Lang:t("info.ammoforthe", {value = ammo, weapon = QBCore.Shared.Weapons[weapon]["label"]}), 'success') - else - weapon = GetSelectedPedWeapon(ped) - if weapon ~= nil then - SetPedAmmo(ped, weapon, ammo) - QBCore.Functions.Notify(Lang:t("info.ammoforthe", {value = ammo, weapon = QBCore.Shared.Weapons[weapon]["label"]}), 'success') - else - QBCore.Functions.Notify(Lang:t("error.no_weapon"), 'error') - end - end -end) - RegisterNetEvent('qb-admin:client:GiveNuiFocus', function(focus, mouse) SetNuiFocus(focus, mouse) end) @@ -158,7 +141,7 @@ function PerformanceUpgradeVehicle(vehicle, customWheels) SetVehicleMod(vehicle, modType, max, customWheels) end ToggleVehicleMod(vehicle, 18, true) -- Turbo - SetVehicleFixed(vehicle) + SetVehicleFixed(vehicle) end end @@ -166,4 +149,3 @@ RegisterNetEvent('qb-admin:client:maxmodVehicle', function() local vehicle = GetVehiclePedIsIn(PlayerPedId()) PerformanceUpgradeVehicle(vehicle) end) - diff --git a/server/server.lua b/server/server.lua index 7234853..f44b13a 100644 --- a/server/server.lua +++ b/server/server.lua @@ -7,14 +7,14 @@ local permissions = { ['noclip'] = 'admin', ['kickall'] = 'admin', ['kick'] = 'admin', - ["revive"] = "admin", - ["freeze"] = "admin", - ["goto"] = "admin", - ["spectate"] = "admin", - ["intovehicle"] = "admin", - ["bring"] = "admin", - ["inventory"] = "admin", - ["clothing"] = "admin" + ['revive'] = 'admin', + ['freeze'] = 'admin', + ['goto'] = 'admin', + ['spectate'] = 'admin', + ['intovehicle'] = 'admin', + ['bring'] = 'admin', + ['inventory'] = 'admin', + ['clothing'] = 'admin' } local players = {} @@ -51,11 +51,11 @@ local function BanPlayer(src) QBCore.Functions.GetIdentifier(src, 'license'), QBCore.Functions.GetIdentifier(src, 'discord'), QBCore.Functions.GetIdentifier(src, 'ip'), - "Trying to revive theirselves or other players", + 'Trying to revive theirselves or other players', 2147483647, 'qb-adminmenu' }) - TriggerEvent('qb-log:server:CreateLog', 'adminmenu', 'Player Banned', 'red', string.format('%s was banned by %s for %s', GetPlayerName(src), 'qb-adminmenu', "Trying to trigger admin options which they dont have permission for"), true) + TriggerEvent('qb-log:server:CreateLog', 'adminmenu', 'Player Banned', 'red', string.format('%s was banned by %s for %s', GetPlayerName(src), 'qb-adminmenu', 'Trying to trigger admin options which they dont have permission for'), true) DropPlayer(src, 'You were permanently banned by the server for: Exploiting') end @@ -67,7 +67,7 @@ end) RegisterNetEvent('qb-admin:server:kill', function(player) local src = source - if QBCore.Functions.HasPermission(src, permissions['kill']) or IsPlayerAceAllowed(src, 'command') then + if QBCore.Functions.HasPermission(src, permissions['kill']) or IsPlayerAceAllowed(src, 'command') then TriggerClientEvent('hospital:client:KillPlayer', player.id) else BanPlayer(src) @@ -76,7 +76,7 @@ end) RegisterNetEvent('qb-admin:server:revive', function(player) local src = source - if QBCore.Functions.HasPermission(src, permissions['revive']) or IsPlayerAceAllowed(src, 'command') then + if QBCore.Functions.HasPermission(src, permissions['revive']) or IsPlayerAceAllowed(src, 'command') then TriggerClientEvent('hospital:client:Revive', player.id) else BanPlayer(src) @@ -85,9 +85,9 @@ end) RegisterNetEvent('qb-admin:server:kick', function(player, reason) local src = source - if QBCore.Functions.HasPermission(src, permissions['kick']) or IsPlayerAceAllowed(src, 'command') then + if QBCore.Functions.HasPermission(src, permissions['kick']) or IsPlayerAceAllowed(src, 'command') then TriggerEvent('qb-log:server:CreateLog', 'bans', 'Player Kicked', 'red', string.format('%s was kicked by %s for %s', GetPlayerName(player.id), GetPlayerName(src), reason), true) - DropPlayer(player.id, Lang:t("info.kicked_server") .. ':\n' .. reason .. '\n\n' .. Lang:t("info.check_discord") .. QBCore.Config.Server.Discord) + DropPlayer(player.id, Lang:t('info.kicked_server') .. ':\n' .. reason .. '\n\n' .. Lang:t('info.check_discord') .. QBCore.Config.Server.Discord) else BanPlayer(src) end @@ -113,13 +113,13 @@ RegisterNetEvent('qb-admin:server:ban', function(player, time, reason) }) TriggerClientEvent('chat:addMessage', -1, { template = "
ANNOUNCEMENT | {0} has been banned: {1}
", - args = {GetPlayerName(player.id), reason} + args = { GetPlayerName(player.id), reason } }) TriggerEvent('qb-log:server:CreateLog', 'bans', 'Player Banned', 'red', string.format('%s was banned by %s for %s', GetPlayerName(player.id), GetPlayerName(src), reason), true) if banTime >= 2147483647 then - DropPlayer(player.id, Lang:t("info.banned") .. '\n' .. reason .. Lang:t("info.ban_perm") .. QBCore.Config.Server.Discord) + DropPlayer(player.id, Lang:t('info.banned') .. '\n' .. reason .. Lang:t('info.ban_perm') .. QBCore.Config.Server.Discord) else - DropPlayer(player.id, Lang:t("info.banned") .. '\n' .. reason .. Lang:t("info.ban_expires") .. timeTable['day'] .. '/' .. timeTable['month'] .. '/' .. timeTable['year'] .. ' ' .. timeTable['hour'] .. ':' .. timeTable['min'] .. '\n🔸 Check our Discord for more information: ' .. QBCore.Config.Server.Discord) + DropPlayer(player.id, Lang:t('info.banned') .. '\n' .. reason .. Lang:t('info.ban_expires') .. timeTable['day'] .. '/' .. timeTable['month'] .. '/' .. timeTable['year'] .. ' ' .. timeTable['hour'] .. ':' .. timeTable['min'] .. '\n🔸 Check our Discord for more information: ' .. QBCore.Config.Server.Discord) end else BanPlayer(src) @@ -169,20 +169,20 @@ RegisterNetEvent('qb-admin:server:intovehicle', function(player) if QBCore.Functions.HasPermission(src, permissions['intovehicle']) or IsPlayerAceAllowed(src, 'command') then local admin = GetPlayerPed(src) local targetPed = GetPlayerPed(player.id) - local vehicle = GetVehiclePedIsIn(targetPed,false) + local vehicle = GetVehiclePedIsIn(targetPed, false) local seat = -1 if vehicle ~= 0 then - for i=0,8,1 do - if GetPedInVehicleSeat(vehicle,i) == 0 then + for i = 0, 8, 1 do + if GetPedInVehicleSeat(vehicle, i) == 0 then seat = i break end end if seat ~= -1 then - SetPedIntoVehicle(admin,vehicle,seat) - TriggerClientEvent('QBCore:Notify', src, Lang:t("sucess.entered_vehicle"), 'success', 5000) + SetPedIntoVehicle(admin, vehicle, seat) + TriggerClientEvent('QBCore:Notify', src, Lang:t('sucess.entered_vehicle'), 'success', 5000) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_free_seats"), 'danger', 5000) + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_free_seats'), 'danger', 5000) end end else @@ -225,7 +225,7 @@ RegisterNetEvent('qb-admin:server:setPermissions', function(targetId, group) local src = source if QBCore.Functions.HasPermission(src, 'god') or IsPlayerAceAllowed(src, 'command') then QBCore.Functions.AddPermission(targetId, group[1].rank) - TriggerClientEvent('QBCore:Notify', targetId, Lang:t("info.rank_level")..group[1].label) + TriggerClientEvent('QBCore:Notify', targetId, Lang:t('info.rank_level') .. group[1].label) else BanPlayer(src) end @@ -236,9 +236,9 @@ RegisterNetEvent('qb-admin:server:SendReport', function(name, targetSrc, msg) if QBCore.Functions.HasPermission(src, 'admin') or IsPlayerAceAllowed(src, 'command') then if QBCore.Functions.IsOptin(src) then TriggerClientEvent('chat:addMessage', src, { - color = {255, 0, 0}, + color = { 255, 0, 0 }, multiline = true, - args = {Lang:t("info.admin_report")..name..' ('..targetSrc..')', msg} + args = { Lang:t('info.admin_report') .. name .. ' (' .. targetSrc .. ')', msg } }) end end @@ -269,9 +269,9 @@ RegisterNetEvent('qb-admin:server:SaveCar', function(mods, vehicle, _, plate) plate, 0 }) - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.success_vehicle_owner"), 'success', 5000) + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.success_vehicle_owner'), 'success', 5000) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.failed_vehicle_owner"), 'error', 3000) + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.failed_vehicle_owner'), 'error', 3000) end else BanPlayer(src) @@ -280,58 +280,58 @@ end) -- Commands -QBCore.Commands.Add('maxmods', Lang:t("desc.max_mod_desc"), {}, false, function(source) +QBCore.Commands.Add('maxmods', Lang:t('desc.max_mod_desc'), {}, false, function(source) local src = source TriggerClientEvent('qb-admin:client:maxmodVehicle', src) end, 'admin') -QBCore.Commands.Add('blips', Lang:t("commands.blips_for_player"), {}, false, function(source) +QBCore.Commands.Add('blips', Lang:t('commands.blips_for_player'), {}, false, function(source) local src = source TriggerClientEvent('qb-admin:client:toggleBlips', src) end, 'admin') -QBCore.Commands.Add('names', Lang:t("commands.player_name_overhead"), {}, false, function(source) +QBCore.Commands.Add('names', Lang:t('commands.player_name_overhead'), {}, false, function(source) local src = source TriggerClientEvent('qb-admin:client:toggleNames', src) end, 'admin') -QBCore.Commands.Add('coords', Lang:t("commands.coords_dev_command"), {}, false, function(source) +QBCore.Commands.Add('coords', Lang:t('commands.coords_dev_command'), {}, false, function(source) local src = source TriggerClientEvent('qb-admin:client:ToggleCoords', src) end, 'admin') -QBCore.Commands.Add('noclip', Lang:t("commands.toogle_noclip"), {}, false, function(source) +QBCore.Commands.Add('noclip', Lang:t('commands.toogle_noclip'), {}, false, function(source) local src = source TriggerClientEvent('qb-admin:client:ToggleNoClip', src) end, 'admin') -QBCore.Commands.Add('admincar', Lang:t("commands.save_vehicle_garage"), {}, false, function(source, _) +QBCore.Commands.Add('admincar', Lang:t('commands.save_vehicle_garage'), {}, false, function(source, _) TriggerClientEvent('qb-admin:client:SaveCar', source) end, 'admin') -QBCore.Commands.Add('announce', Lang:t("commands.make_announcement"), {}, false, function(_, args) +QBCore.Commands.Add('announce', Lang:t('commands.make_announcement'), {}, false, function(_, args) local msg = table.concat(args, ' ') if msg == '' then return end TriggerClientEvent('chat:addMessage', -1, { - color = { 255, 0, 0}, + color = { 255, 0, 0 }, multiline = true, - args = {"Announcement", msg} + args = { 'Announcement', msg } }) end, 'admin') -QBCore.Commands.Add('admin', Lang:t("commands.open_admin"), {}, false, function(source, _) +QBCore.Commands.Add('admin', Lang:t('commands.open_admin'), {}, false, function(source, _) TriggerClientEvent('qb-admin:client:openMenu', source) end, 'admin') -QBCore.Commands.Add('report', Lang:t("info.admin_report"), {{name='message', help='Message'}}, true, function(source, args) +QBCore.Commands.Add('report', Lang:t('info.admin_report'), { { name = 'message', help = 'Message' } }, true, function(source, args) local src = source local msg = table.concat(args, ' ') local Player = QBCore.Functions.GetPlayer(source) TriggerClientEvent('qb-admin:client:SendReport', -1, GetPlayerName(src), src, msg) - TriggerEvent('qb-log:server:CreateLog', 'report', 'Report', 'green', '**'..GetPlayerName(source)..'** (CitizenID: '..Player.PlayerData.citizenid..' | ID: '..source..') **Report:** ' ..msg, false) + TriggerEvent('qb-log:server:CreateLog', 'report', 'Report', 'green', '**' .. GetPlayerName(source) .. '** (CitizenID: ' .. Player.PlayerData.citizenid .. ' | ID: ' .. source .. ') **Report:** ' .. msg, false) end) -QBCore.Commands.Add('staffchat', Lang:t("commands.staffchat_message"), {{name='message', help='Message'}}, true, function(source, args) +QBCore.Commands.Add('staffchat', Lang:t('commands.staffchat_message'), { { name = 'message', help = 'Message' } }, true, function(source, args) local msg = table.concat(args, ' ') local name = GetPlayerName(source) @@ -342,31 +342,31 @@ QBCore.Commands.Add('staffchat', Lang:t("commands.staffchat_message"), {{name='m if QBCore.Functions.HasPermission(plr, 'admin') or IsPlayerAceAllowed(plr, 'command') then if QBCore.Functions.IsOptin(plr) then TriggerClientEvent('chat:addMessage', plr, { - color = {255, 0, 0}, + color = { 255, 0, 0 }, multiline = true, - args = {Lang:t("info.staffchat")..name, msg} + args = { Lang:t('info.staffchat') .. name, msg } }) end end end end, 'admin') -QBCore.Commands.Add('givenuifocus', Lang:t("commands.nui_focus"), {{name='id', help='Player id'}, {name='focus', help='Set focus on/off'}, {name='mouse', help='Set mouse on/off'}}, true, function(_, args) +QBCore.Commands.Add('givenuifocus', Lang:t('commands.nui_focus'), { { name = 'id', help = 'Player id' }, { name = 'focus', help = 'Set focus on/off' }, { name = 'mouse', help = 'Set mouse on/off' } }, true, function(_, args) local playerid = tonumber(args[1]) local focus = args[2] local mouse = args[3] TriggerClientEvent('qb-admin:client:GiveNuiFocus', playerid, focus, mouse) end, 'admin') -QBCore.Commands.Add('warn', Lang:t("commands.warn_a_player"), {{name='ID', help='Player'}, {name='Reason', help='Mention a reason'}}, true, function(source, args) +QBCore.Commands.Add('warn', Lang:t('commands.warn_a_player'), { { name = 'ID', help = 'Player' }, { name = 'Reason', help = 'Mention a reason' } }, true, function(source, args) local targetPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) local senderPlayer = QBCore.Functions.GetPlayer(source) table.remove(args, 1) local msg = table.concat(args, ' ') - local warnId = 'WARN-'..math.random(1111, 9999) + local warnId = 'WARN-' .. math.random(1111, 9999) if targetPlayer ~= nil then - TriggerClientEvent('chat:addMessage', targetPlayer.PlayerData.source, { args = { "SYSTEM", Lang:t("info.warning_chat_message")..GetPlayerName(source).."," .. Lang:t("info.reason") .. ": "..msg }, color = 255, 0, 0 }) - TriggerClientEvent('chat:addMessage', source, { args = { "SYSTEM", Lang:t("info.warning_staff_message")..GetPlayerName(targetPlayer.PlayerData.source)..", for: "..msg }, color = 255, 0, 0 }) + TriggerClientEvent('chat:addMessage', targetPlayer.PlayerData.source, { args = { 'SYSTEM', Lang:t('info.warning_chat_message') .. GetPlayerName(source) .. ',' .. Lang:t('info.reason') .. ': ' .. msg }, color = 255, 0, 0 }) + TriggerClientEvent('chat:addMessage', source, { args = { 'SYSTEM', Lang:t('info.warning_staff_message') .. GetPlayerName(targetPlayer.PlayerData.source) .. ', for: ' .. msg }, color = 255, 0, 0 }) MySQL.insert('INSERT INTO player_warns (senderIdentifier, targetIdentifier, reason, warnId) VALUES (?, ?, ?, ?)', { senderPlayer.PlayerData.license, targetPlayer.PlayerData.license, @@ -374,37 +374,37 @@ QBCore.Commands.Add('warn', Lang:t("commands.warn_a_player"), {{name='ID', help= warnId }) else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.not_online"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error') end end, 'admin') -QBCore.Commands.Add('checkwarns', Lang:t("commands.check_player_warning"), {{name='id', help='Player'}, {name='Warning', help='Number of warning, (1, 2 or 3 etc..)'}}, false, function(source, args) +QBCore.Commands.Add('checkwarns', Lang:t('commands.check_player_warning'), { { name = 'id', help = 'Player' }, { name = 'Warning', help = 'Number of warning, (1, 2 or 3 etc..)' } }, false, function(source, args) if args[2] == nil then local targetPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) local result = MySQL.query.await('SELECT * FROM player_warns WHERE targetIdentifier = ?', { targetPlayer.PlayerData.license }) - TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', targetPlayer.PlayerData.name..' has '..tablelength(result)..' warnings!') + TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', targetPlayer.PlayerData.name .. ' has ' .. tablelength(result) .. ' warnings!') else local targetPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) local warnings = MySQL.query.await('SELECT * FROM player_warns WHERE targetIdentifier = ?', { targetPlayer.PlayerData.license }) local selectedWarning = tonumber(args[2]) if warnings[selectedWarning] ~= nil then local sender = QBCore.Functions.GetPlayer(warnings[selectedWarning].senderIdentifier) - TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', targetPlayer.PlayerData.name..' has been warned by '..sender.PlayerData.name..', Reason: '..warnings[selectedWarning].reason) + TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', targetPlayer.PlayerData.name .. ' has been warned by ' .. sender.PlayerData.name .. ', Reason: ' .. warnings[selectedWarning].reason) end end end, 'admin') -QBCore.Commands.Add('delwarn', Lang:t("commands.delete_player_warning"), {{name='id', help='Player'}, {name='Warning', help='Number of warning, (1, 2 or 3 etc..)'}}, true, function(source, args) +QBCore.Commands.Add('delwarn', Lang:t('commands.delete_player_warning'), { { name = 'id', help = 'Player' }, { name = 'Warning', help = 'Number of warning, (1, 2 or 3 etc..)' } }, true, function(source, args) local targetPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) local warnings = MySQL.query.await('SELECT * FROM player_warns WHERE targetIdentifier = ?', { targetPlayer.PlayerData.license }) local selectedWarning = tonumber(args[2]) if warnings[selectedWarning] ~= nil then - TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', 'You have deleted warning ('..selectedWarning..') , Reason: '..warnings[selectedWarning].reason) + TriggerClientEvent('chat:addMessage', source, 'SYSTEM', 'warning', 'You have deleted warning (' .. selectedWarning .. ') , Reason: ' .. warnings[selectedWarning].reason) MySQL.query('DELETE FROM player_warns WHERE warnId = ?', { warnings[selectedWarning].warnId }) end end, 'admin') -QBCore.Commands.Add('reportr', Lang:t("commands.reply_to_report"), {{name='id', help='Player'}, {name = 'message', help = 'Message to respond with'}}, false, function(source, args) +QBCore.Commands.Add('reportr', Lang:t('commands.reply_to_report'), { { name = 'id', help = 'Player' }, { name = 'message', help = 'Message to respond with' } }, false, function(source, args) local src = source local playerId = tonumber(args[1]) table.remove(args, 1) @@ -414,20 +414,20 @@ QBCore.Commands.Add('reportr', Lang:t("commands.reply_to_report"), {{name='id', if not OtherPlayer then return TriggerClientEvent('QBCore:Notify', src, 'Player is not online', 'error') end if not QBCore.Functions.HasPermission(src, 'admin') or IsPlayerAceAllowed(src, 'command') ~= 1 then return end TriggerClientEvent('chat:addMessage', playerId, { - color = {255, 0, 0}, + color = { 255, 0, 0 }, multiline = true, - args = {'Admin Response', msg} + args = { 'Admin Response', msg } }) TriggerClientEvent('chat:addMessage', src, { - color = {255, 0, 0}, + color = { 255, 0, 0 }, multiline = true, - args = {'Report Response ('..playerId..')', msg} + args = { 'Report Response (' .. playerId .. ')', msg } }) TriggerClientEvent('QBCore:Notify', src, 'Reply Sent') - TriggerEvent('qb-log:server:CreateLog', 'report', 'Report Reply', 'red', '**'..GetPlayerName(src)..'** replied on: **'..OtherPlayer.PlayerData.name.. ' **(ID: '..OtherPlayer.PlayerData.source..') **Message:** ' ..msg, false) + TriggerEvent('qb-log:server:CreateLog', 'report', 'Report Reply', 'red', '**' .. GetPlayerName(src) .. '** replied on: **' .. OtherPlayer.PlayerData.name .. ' **(ID: ' .. OtherPlayer.PlayerData.source .. ') **Message:** ' .. msg, false) end, 'admin') -QBCore.Commands.Add('setmodel', Lang:t("commands.change_ped_model"), {{name='model', help='Name of the model'}, {name='id', help='Id of the Player (empty for yourself)'}}, false, function(source, args) +QBCore.Commands.Add('setmodel', Lang:t('commands.change_ped_model'), { { name = 'model', help = 'Name of the model' }, { name = 'id', help = 'Id of the Player (empty for yourself)' } }, false, function(source, args) local model = args[1] local target = tonumber(args[2]) if model ~= nil or model ~= '' then @@ -438,34 +438,34 @@ QBCore.Commands.Add('setmodel', Lang:t("commands.change_ped_model"), {{name='mod if Trgt ~= nil then TriggerClientEvent('qb-admin:client:SetModel', target, tostring(model)) else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.not_online"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error') end end else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.failed_set_model"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.failed_set_model'), 'error') end end, 'admin') -QBCore.Commands.Add('setspeed', Lang:t("commands.set_player_foot_speed"), {}, false, function(source, args) +QBCore.Commands.Add('setspeed', Lang:t('commands.set_player_foot_speed'), {}, false, function(source, args) local speed = args[1] if speed ~= nil then TriggerClientEvent('qb-admin:client:SetSpeed', source, tostring(speed)) else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.failed_set_speed"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.failed_set_speed'), 'error') end end, 'admin') -QBCore.Commands.Add('reporttoggle', Lang:t("commands.report_toggle"), {}, false, function(source, _) +QBCore.Commands.Add('reporttoggle', Lang:t('commands.report_toggle'), {}, false, function(source, _) local src = source QBCore.Functions.ToggleOptin(src) if QBCore.Functions.IsOptin(src) then - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.receive_reports"), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.receive_reports'), 'success') else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_receive_report"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_receive_report'), 'error') end end, 'admin') -QBCore.Commands.Add('kickall', Lang:t("commands.kick_all"), {}, false, function(source, args) +QBCore.Commands.Add('kickall', Lang:t('commands.kick_all'), {}, false, function(source, args) local src = source if src > 0 then local reason = table.concat(args, ' ') @@ -478,28 +478,27 @@ QBCore.Commands.Add('kickall', Lang:t("commands.kick_all"), {}, false, function( end end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.no_reason_specified"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.no_reason_specified'), 'error') end end else for _, v in pairs(QBCore.Functions.GetPlayers()) do local Player = QBCore.Functions.GetPlayer(v) if Player then - DropPlayer(Player.PlayerData.source, Lang:t("info.server_restart") .. QBCore.Config.Server.Discord) + DropPlayer(Player.PlayerData.source, Lang:t('info.server_restart') .. QBCore.Config.Server.Discord) end end end end, 'god') -QBCore.Commands.Add('setammo', Lang:t("commands.ammo_amount_set"), {{name='amount', help='Amount of bullets, for example: 20'}, {name='weapon', help='Name of the weapon, for example: WEAPON_VINTAGEPISTOL'}}, false, function(source, args) +QBCore.Commands.Add('setammo', Lang:t('commands.ammo_amount_set'), { { name = 'amount', help = 'Amount of bullets, for example: 20' } }, false, function(source, args) local src = source - local weapon = args[2] + local ped = GetPlayerPed(src) local amount = tonumber(args[1]) - - if weapon ~= nil then - TriggerClientEvent('qb-weapons:client:SetWeaponAmmoManual', src, weapon, amount) - else - TriggerClientEvent('qb-weapons:client:SetWeaponAmmoManual', src, 'current', amount) + local weapon = GetSelectedPedWeapon(ped) + if weapon and amount then + SetPedAmmo(ped, weapon, amount) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.ammoforthe', { value = amount, weapon = QBCore.Shared.Weapons[weapon]['label'] }), 'success') end end, 'admin')