Weapon attachment rework

This commit is contained in:
Kakarot
2023-11-03 09:40:35 -05:00
parent 4e184ba1c8
commit a73e878487
18 changed files with 857 additions and 940 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ local function hideText()
end
local function drawText(text, position)
if type(position) ~= "string" then position = "left" end
if type(position) ~= 'string' then position = 'left' end
SendNUIMessage({
action = 'DRAW_TEXT',
@@ -17,7 +17,7 @@ local function drawText(text, position)
end
local function changeText(text, position)
if type(position) ~= "string" then position = "left" end
if type(position) ~= 'string' then position = 'left' end
SendNUIMessage({
action = 'CHANGE_TEXT',
+8 -8
View File
@@ -37,7 +37,7 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
local blipMarker <const> = GetFirstBlipInfoId(8)
if not DoesBlipExist(blipMarker) then
QBCore.Functions.Notify(Lang:t("error.no_waypoint"), "error", 5000)
QBCore.Functions.Notify(Lang:t('error.no_waypoint'), 'error', 5000)
return 'marker'
end
@@ -108,12 +108,12 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
-- If we can't find the coords, set the coords to the old ones.
-- We don't unpack them before since they aren't in a loop and only called once.
SetPedCoordsKeepVehicle(ped, oldCoords['x'], oldCoords['y'], oldCoords['z'] - 1.0)
QBCore.Functions.Notify(Lang:t("error.tp_error"), "error", 5000)
QBCore.Functions.Notify(Lang:t('error.tp_error'), 'error', 5000)
end
-- If Z coord was found, set coords in found coords.
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
QBCore.Functions.Notify(Lang:t("success.teleported_waypoint"), "success", 5000)
QBCore.Functions.Notify(Lang:t('success.teleported_waypoint'), 'success', 5000)
end)
-- Vehicle Commands
@@ -138,7 +138,7 @@ RegisterNetEvent('QBCore:Command:SpawnVehicle', function(vehName)
SetVehicleFuelLevel(vehicle, 100.0)
SetVehicleDirtLevel(vehicle, 0.0)
SetModelAsNoLongerNeeded(hash)
TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(vehicle))
TriggerEvent('vehiclekeys:client:SetOwner', QBCore.Functions.GetPlate(vehicle))
end)
RegisterNetEvent('QBCore:Command:DeleteVehicle', function()
@@ -177,7 +177,7 @@ RegisterNetEvent('QBCore:Client:VehicleInfo', function(info)
haskeys = hasKeys
}
TriggerEvent('QBCore:Client:'..info.event..'Vehicle', data)
TriggerEvent('QBCore:Client:' .. info.event .. 'Vehicle', data)
end)
-- Other stuff
@@ -196,7 +196,7 @@ end)
-- This event is exploitable and should not be used. It has been deprecated, and will be removed soon.
RegisterNetEvent('QBCore:Client:UseItem', function(item)
QBCore.Debug(string.format("%s triggered QBCore:Client:UseItem by ID %s with the following data. This event is deprecated due to exploitation, and will be removed soon. Check qb-inventory for the right use on this event.", GetInvokingResource(), GetPlayerServerId(PlayerId())))
QBCore.Debug(string.format('%s triggered QBCore:Client:UseItem by ID %s with the following data. This event is deprecated due to exploitation, and will be removed soon. Check qb-inventory for the right use on this event.', GetInvokingResource(), GetPlayerServerId(PlayerId())))
QBCore.Debug(item)
end)
@@ -231,7 +231,7 @@ local function Draw3DText(coords, str)
SetTextProportional(1)
SetTextOutline()
SetTextCentre(1)
BeginTextCommandDisplayText("STRING")
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(str)
EndTextCommandDisplayText(worldX, worldY)
end
@@ -265,4 +265,4 @@ end)
RegisterNetEvent('QBCore:Client:SharedUpdate', function(table)
QBCore.Shared = table
end)
end)
+1 -1
View File
@@ -12,7 +12,7 @@ end)
CreateThread(function()
while true do
if LocalPlayer.state.isLoggedIn then
if (QBCore.PlayerData.metadata['hunger'] <= 0 or QBCore.PlayerData.metadata['thirst'] <= 0) and not (QBCore.PlayerData.metadata['isdead'] or QBCore.PlayerData.metadata["inlaststand"]) then
if (QBCore.PlayerData.metadata['hunger'] <= 0 or QBCore.PlayerData.metadata['thirst'] <= 0) and not (QBCore.PlayerData.metadata['isdead'] or QBCore.PlayerData.metadata['inlaststand']) then
local ped = PlayerPedId()
local currentHealth = GetEntityHealth(ped)
local decreaseThreshold = math.random(5, 10)