Merge branch 'main' into main

This commit is contained in:
David Malchin
2022-07-23 19:39:00 +03:00
committed by GitHub
8 changed files with 65 additions and 31 deletions
+1 -1
View File
@@ -396,7 +396,7 @@ function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked, teleportI
else
coords = GetEntityCoords(ped)
end
isnetworked = isnetworked or true
isnetworked = isnetworked == nil or isnetworked
QBCore.Functions.LoadModel(model)
local veh = CreateVehicle(model, coords.x, coords.y, coords.z, coords.w, isnetworked, false)
local netid = NetworkGetNetworkIdFromEntity(veh)
+1 -1
View File
@@ -6,7 +6,7 @@ QBConfig.UpdateInterval = 5 -- how often to update player data in minutes
QBConfig.StatusInterval = 5000 -- how often to check hunger/thirst status in milliseconds
QBConfig.Money = {}
QBConfig.Money.MoneyTypes = { ['cash'] = 500, ['bank'] = 5000, ['crypto'] = 0 } -- ['type'] = startamount - Add or remove money types for your server (for ex. ['blackmoney'] = 0), remember once added it will not be removed from the database!
QBConfig.Money.MoneyTypes = { cash = 500, bank = 5000, crypto = 0 } -- type = startamount - Add or remove money types for your server (for ex. blackmoney = 0), remember once added it will not be removed from the database!
QBConfig.Money.DontAllowMinus = { 'cash', 'crypto' } -- Money that is not allowed going in minus
QBConfig.Money.PayCheckTimeOut = 10 -- The time in minutes that it will give the paycheck
QBConfig.Money.PayCheckSociety = false -- If true paycheck will come from the society account that the player is employed at, requires qb-management
-1
View File
@@ -8,7 +8,6 @@ import {
} from "./config.js";
const { useQuasar } = Quasar;
const { onMounted, onUnmounted } = Vue;
const app = Vue.createApp({
+2 -2
View File
@@ -13,13 +13,13 @@ export const DEV_MODE = false;
* Will hold config statically outside of Vue state
* @property {Record<string, NotiVariantData>} VariantDefinitions
* @property {Record<string, any>} NotificationStyling
* */
**/
export let NOTIFY_CONFIG = null;
/**
* Pure function taking a notification type and returning an object
* with style details
* @param variant {string}
* @param {string} variant
* @returns NotiVariantData
**/
export const determineStyleFromVariant = (variant) => {
+12
View File
@@ -244,3 +244,15 @@ QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, am
end
cb(retval)
end)
-- Vehicle server-side spawning callback (netId)
-- use the netid on the client with the NetworkGetEntityFromNetworkId native
-- convert it to a vehicle via the NetToVeh native
QBCore.Functions.CreateCallback('QBCore:Server:SpawnVehicle', function(source, cb, model, coords, warp)
model = type(model) == 'string' and GetHashKey(model) or model
if not coords then coords = GetEntityCoords(GetPlayerPed(source)) end
local veh = CreateVehicle(model, coords.x, coords.y, coords.z, coords.w, true, true)
while not DoesEntityExist(veh) do Wait(0) end
if warp then TaskWarpPedIntoVehicle(GetPlayerPed(source), veh, -1) end
cb(NetworkGetNetworkIdFromEntity(veh))
end)
+24
View File
@@ -167,6 +167,30 @@ function QBCore.Functions.GetEntitiesInBucket(bucket --[[ int ]])
end
end
-- Server side vehicle creation with optional callback
-- the CreateVehicle RPC still uses the client for creation so players must be near
function QBCore.Functions.SpawnVehicle(model, cb, coords, warp)
model = type(model) == 'string' and GetHashKey(model) or model
if not coords then coords = GetEntityCoords(GetPlayerPed(source)) end
local veh = CreateVehicle(model, coords.x, coords.y, coords.z, coords.w, true, true)
while not DoesEntityExist(veh) do Wait(0) end
if warp then TaskWarpPedIntoVehicle(GetPlayerPed(source), veh, -1) end
if cb then cb(veh) end
end
-- Server side vehicle creation with optional callback
-- the CreateAutomobile native is still experimental but doesn't use client for creation
-- doesn't work for all vehicles!
function QBCore.Functions.CreateVehicle(model, cb, coords, warp)
model = type(model) == 'string' and GetHashKey(model) or model
if not coords then coords = GetEntityCoords(GetPlayerPed(source)) end
local CreateAutomobile = GetHashKey("CREATE_AUTOMOBILE")
local veh = Citizen.InvokeNative(CreateAutomobile, model, coords, coords.w, true, true)
while not DoesEntityExist(veh) do Wait(0) end
if warp then TaskWarpPedIntoVehicle(GetPlayerPed(source), veh, -1) end
if cb then cb(veh) end
end
-- Paychecks (standalone - don't touch)
function PaycheckInterval()
+5 -6
View File
@@ -44,7 +44,7 @@ end
--- internally for initial population of phrases field.
--- @param phrases table<string, string> - Table of phrase definitions
--- @param prefix string | nil - Optional prefix used for recursive calls
--- @return void
--- @return nil
function Locale:extend(phrases, prefix)
for key, phrase in pairs(phrases) do
local prefixKey = prefix and ('%s.%s'):format(prefix, key) or key
@@ -57,10 +57,9 @@ function Locale:extend(phrases, prefix)
end
end
--- Clear locale instance phrases
--- Might be useful for memory management of large phrase maps.
--- @return void
--- @return nil
function Locale:clear()
self.phrases = {}
end
@@ -69,8 +68,8 @@ end
--- @param phrases table<string, any>
function Locale:replace(phrases)
phrases = phrases or {}
self.clear()
self.extend(phrases)
self:clear()
self:extend(phrases)
end
--- Gets & Sets a locale depending on if an argument is passed
@@ -85,7 +84,7 @@ end
--- Primary translation method for a phrase of given key
--- @param key string - The phrase key to target
--- @param subs table<string, string>
--- @param subs table<string, any> | nil
--- @return string
function Locale:t(key, subs)
local phrase, result
+20 -20
View File
@@ -3,9 +3,9 @@ QBShared = QBShared or {}
local StringCharset = {}
local NumberCharset = {}
for i = 48, 57 do NumberCharset[#NumberCharset+1] = string.char(i) end
for i = 65, 90 do StringCharset[#StringCharset+1] = string.char(i) end
for i = 97, 122 do StringCharset[#StringCharset+1] = string.char(i) end
for i = 48, 57 do NumberCharset[#NumberCharset + 1] = string.char(i) end
for i = 65, 90 do StringCharset[#StringCharset + 1] = string.char(i) end
for i = 97, 122 do StringCharset[#StringCharset + 1] = string.char(i) end
function QBShared.RandomStr(length)
if length <= 0 then return '' end
@@ -22,16 +22,16 @@ function QBShared.SplitStr(str, delimiter)
local from = 1
local delim_from, delim_to = string.find(str, delimiter, from)
while delim_from do
result[#result+1] = string.sub(str, from, delim_from - 1)
result[#result + 1] = string.sub(str, from, delim_from - 1)
from = delim_to + 1
delim_from, delim_to = string.find(str, delimiter, from)
end
result[#result+1] = string.sub(str, from)
result[#result + 1] = string.sub(str, from)
return result
end
function QBShared.Trim(value)
if not value then return nil end
if not value then return nil end
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
end
@@ -42,24 +42,24 @@ function QBShared.Round(value, numDecimalPlaces)
end
function QBShared.ChangeVehicleExtra(vehicle, extra, enable)
if DoesExtraExist(vehicle, extra) then
if enable then
SetVehicleExtra(vehicle, extra, false)
if not IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
else
SetVehicleExtra(vehicle, extra, true)
if IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
end
end
if DoesExtraExist(vehicle, extra) then
if enable then
SetVehicleExtra(vehicle, extra, false)
if not IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
else
SetVehicleExtra(vehicle, extra, true)
if IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
end
end
end
function QBShared.SetDefaultVehicleExtras(vehicle, config)
-- Clear Extras
for i = 1,20 do
for i = 1, 20 do
if DoesExtraExist(vehicle, i) then
SetVehicleExtra(vehicle, i, 1)
end