diff --git a/client/events.lua b/client/events.lua index 66f88e0..e9b6655 100644 --- a/client/events.lua +++ b/client/events.lua @@ -24,9 +24,10 @@ RegisterNetEvent('QBCore:Command:TeleportToPlayer', function(coords) SetPedCoordsKeepVehicle(ped, coords.x, coords.y, coords.z) end) -RegisterNetEvent('QBCore:Command:TeleportToCoords', function(x, y, z) +RegisterNetEvent('QBCore:Command:TeleportToCoords', function(x, y, z, h) local ped = PlayerPedId() SetPedCoordsKeepVehicle(ped, x, y, z) + SetEntityHeading(ped, h or GetEntityHeading(ped)) end) RegisterNetEvent('QBCore:Command:GoToMarker', function() diff --git a/locale/en.lua b/locale/en.lua index 57b8f02..d03b40b 100644 --- a/locale/en.lua +++ b/locale/en.lua @@ -8,6 +8,7 @@ local Translations = { 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 = 'Duplicate Rockstar License Found', no_valid_license = 'No Valid Rockstar License Found', not_whitelisted = 'You\'re not whitelisted for this server', @@ -26,7 +27,7 @@ local Translations = { off_duty = 'You are now off duty!', checking_ban = 'Hello %s. We are checking if you are banned.', join_server = 'Welcome %s to {Server Name}.', - checking_whitelisted = 'Hello %s. We are checking your allowance.' + checking_whitelisted = 'Hello %s. We are checking your allowance.', } } diff --git a/server/commands.lua b/server/commands.lua index b4f5d82..38f2766 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -81,15 +81,23 @@ function QBCore.Commands.Refresh(source) end -- Teleport - -QBCore.Commands.Add('tp', 'TP To Player or Coords (Admin Only)', { { name = 'id/x', help = 'ID of player or X position' }, { name = 'y', help = 'Y position' }, { name = 'z', help = 'Z position' } }, false, function(source, args) +QBCore.Commands.Add('tp', 'TP To Location/Player/Coords (Admin Only)', { { name = 'location/id/x', help = 'location name, ID of player, or X position' }, { name = 'y', help = 'Y position' }, { name = 'z', help = 'Z position' } }, false, function(source, args) if args[1] and not args[2] and not args[3] then - local target = GetPlayerPed(tonumber(args[1])) - if target ~= 0 then - local coords = GetEntityCoords(target) - TriggerClientEvent('QBCore:Command:TeleportToPlayer', source, coords) + if tonumber(args[1]) then + local target = GetPlayerPed(tonumber(args[1])) + if target ~= 0 then + local coords = GetEntityCoords(target) + TriggerClientEvent('QBCore:Command:TeleportToPlayer', source, coords) + else + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error') + end else - TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error') + local location = QBShared.Locations[args[1]] + if location then + TriggerClientEvent('QBCore:Command:TeleportToCoords', source, location.x, location.y, location.z, location.w) + else + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.location_not_exist'), 'error') + end end else if args[1] and args[2] and args[3] then diff --git a/server/events.lua b/server/events.lua index bb2995a..464dbed 100644 --- a/server/events.lua +++ b/server/events.lua @@ -173,18 +173,16 @@ RegisterNetEvent('QBCore:Server:UseItem', function(item) QBCore.Debug(item) end) -RegisterNetEvent('QBCore:Server:RemoveItem', function(itemName, amount, slot) +-- This event is exploitable and should not be used. It has been deprecated, and will be removed soon. function(itemName, amount, slot) +RegisterNetEvent('QBCore:Server:RemoveItem', function(itemName, amount) local src = source - local Player = QBCore.Functions.GetPlayer(src) - if not Player then return end - Player.Functions.RemoveItem(itemName, amount, slot) + print(string.format("%s triggered QBCore:Server:RemoveItem by ID %s for %s %s. This event is deprecated due to exploitation, and will be removed soon. Adjust your events accordingly to do this server side with player functions.", GetInvokingResource(), src, amount, itemName)) end) -RegisterNetEvent('QBCore:Server:AddItem', function(itemName, amount, slot, info) +-- This event is exploitable and should not be used. It has been deprecated, and will be removed soon. function(itemName, amount, slot, info) +RegisterNetEvent('QBCore:Server:AddItem', function(itemName, amount) local src = source - local Player = QBCore.Functions.GetPlayer(src) - if not Player then return end - Player.Functions.AddItem(itemName, amount, slot, info) + print(string.format("%s triggered QBCore:Server:AddItem by ID %s for %s %s. This event is deprecated due to exploitation, and will be removed soon. Adjust your events accordingly to do this server side with player functions.", GetInvokingResource(), src, amount, itemName)) end) -- Non-Chat Command Calling (ex: qb-adminmenu) diff --git a/server/functions.lua b/server/functions.lua index df55be2..16124c9 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -199,7 +199,6 @@ function QBCore.Functions.CreateVehicle(source, model, coords, warp) end -- Paychecks (standalone - don't touch) - function PaycheckInterval() if next(QBCore.Players) then for _, Player in pairs(QBCore.Players) do diff --git a/server/player.lua b/server/player.lua index 0c5064e..eb8eb25 100644 --- a/server/player.lua +++ b/server/player.lua @@ -167,6 +167,7 @@ end function QBCore.Player.Logout(source) TriggerClientEvent('QBCore:Client:OnPlayerUnload', source) + TriggerEvent('QBCore:Server:OnPlayerUnload', source) TriggerClientEvent('QBCore:Player:UpdatePlayerData', source) Wait(200) QBCore.Players[source] = nil @@ -269,6 +270,12 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline) self.Functions.UpdatePlayerData() end + function self.Functions.GetMetaData(meta) + if not meta or type(meta) ~= 'string' then return end + meta = meta:lower() + return self.PlayerData.metadata[meta] + end + function self.Functions.AddJobReputation(amount) if not amount then return end amount = tonumber(amount) diff --git a/shared/locations.lua b/shared/locations.lua new file mode 100644 index 0000000..7c97fed --- /dev/null +++ b/shared/locations.lua @@ -0,0 +1,58 @@ +QBShared.Locations = { + -- Unknown/Random/Vanilla + ['burgershot'] = vector4(-1199.0568, -882.4495, 13.3500, 209.1105), + ['casino'] = vector4(923.2289, 47.3113, 81.1063, 237.6052), + + -- Gabz + ['arcade'] = vector4(-1649.6089, -1083.9313, 13.1575, 46.4121), + ['beanmachinelegion'] = vector4(116.16, -1022.99, 29.3, 0.0), + ['bowling'] = vector4(761.5008, -777.7256, 26.3078, 90.5581), + ['pizzaria'] = vector4(790.4561, -758.4601, 26.7424, 270.2329), + ['catcafe'] = vector4(-580.8388, -1072.7872, 22.3296, 359.0078), + ['carmeet'] = vector4(958.8237, -1699.6659, 29.5574, 71.2731), + ['davispd'] = vector4(382.5791, -1591.1827, 29.2828, 145.0991), + ['popsdiner'] = vector4(1595.9753, 6448.6421, 25.3170, 28.3026), + ['davisfirestation'] = vector4(216.7576, -1638.3801, 29.5151, 137.8174), + ['harmony'] = vector4(1183.0693, 2648.5313, 37.8363, 194.0603), + ['haters'] = vector4(-1117.1525, -1439.4297, 5.1075, 103.4411), + ['hayes'] = vector4(-1435.7040, -445.7360, 35.5964, 220.1762), + ['pdm'] = vector4(-48.2113, -1105.4769, 27.2634, 339.5899), + ['bennys'] = vector4(-47.5289, -1042.6086, 28.3532, 247.9748), + ['impound'] = vector4(-190.5874, -1156.1343, 23.0482, 158.9385), + ['lamesaauto'] = vector4(720.4776, -1092.1934, 22.2866, 310.1469), + ['lamesapd'] = vector4(824.3735, -1290.0670, 28.2364, 266.1293), + ['lostmc'] = vector4(982.6339, -104.7095, 74.8488, 30.8738), + ['pillbox'] = vector4(298.1153, -584.2825, 43.2609, 252.7553), + ['mrpd'] = vector4(432.0686, -981.6853, 30.7119, 267.3501), + ['mirrorparkhouse1'] = vector4(945.9535, -652.9119, 58.0228, 90.5541), + ['pacificbank'] = vector4(229.9529, 214.3890, 105.5561, 294.6791), + ['paletoliquor'] = vector4(-154.2287, 6328.8682, 31.5665, 133.1992), + ['paletopd'] = vector4(-436.0935, 6015.2026, 31.4892, 132.9752), + ['paletogasstation'] = vector4(120.2420, 6625.4722, 31.9580, 36.5687), + ['pinkcage'] = vector4(323.9055, -203.2524, 54.0866, 186.8505), + ['ponsonbys1'] = vector4(-165.2497, -304.3988, 38.07126, 0.0), + ['ponsonbys2'] = vector4(-1448.1, -236.8420, 48.15098, 0.0), + ['ponsonbys3'] = vector4(-709.8120, -150.6267, 35.75312, 0.0), + ['prison'] = vector4(1847.1284, 2586.0696, 45.6726, 91.7828), + ['rangerstation'] = vector4(387.3204, 790.1508, 187.6927, 4.7656), + ['recordastudio'] = vector4(473.3006, -109.4360, 62.7418, 350.8488), + ['sandypd'] = vector4(1839.7510, 3667.9907, 33.8787, 29.1744), + ['suburban1'] = vector4(124.9756, -217.6290, 55.81879, 0.0), + ['suburban2'] = vector4(617.4776, 2757.4810, 43.34935, 0.0), + ['suburban3'] = vector4(-1195.8690, -773.5746, 18.58485, 0.0), + ['suburban4'] = vector4(-3170.9670, 1049.9310, 22.12445, 0.0), + ['triadrecords'] = vector4(-829.0061, -698.2049, 28.0583, 291.2052), + ['tuner'] = vector4(157.5888, -3017.9968, 7.0400, 94.0695), + ['vu'] = vector4(129.4555, -1299.6754, 29.2327, 27.6378), + + -- Patoche + ['luxerydealership'] = vector4(-1273.22, -371.11, 36.64, 301.8), + + -- Unclejust + ['digitalden'] = vector4(-656.28, -849.92, 24.51, 167.42), + ['ifruitstore1'] = vector4(-646.78, -288.17, 35.49, 297.73), + ['ifruitstore2'] = vector4(-778.7451, -598.2717, 30.2772, 181.0197), + ['taxijob'] = vector4(908.7, -166.45, 74.13, 54.88), + ['vineyard'] = vector4(-1892.29, 2038.47, 140.86, 339.23), + ['weazelnews'] = vector4(-604.82, -933.22, 23.86, 292.3), +} \ No newline at end of file