From 4ad4a22844088e8ac5b8871940709f91871a6a69 Mon Sep 17 00:00:00 2001 From: Artur Michalak <36608116+ArturMichalak@users.noreply.github.com> Date: Sat, 6 Apr 2024 18:23:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20drawtext3d=20coords=20(#16?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix drawtext3d coords * refactor(server/main): use qbx.spawnVehicle * fix(server/main): return netId --------- Co-authored-by: solareon <769465+solareon@users.noreply.github.com> --- client/main.lua | 4 ++-- fxmanifest.lua | 2 +- server/main.lua | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index 9d8d939..71fff93 100644 --- a/client/main.lua +++ b/client/main.lua @@ -105,7 +105,7 @@ local function getDeliveryLocation() if dist < 20 then DrawMarker(2, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].x, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].y, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.3, 255, 255, 255, 255, false, false, 0, true, nil, nil, false) if dist < 5 then - DrawText3D(sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].x, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].y, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].z, Lang:t('info.drop_off_npc')) + qbx.drawText3d({text = Lang:t('info.drop_off_npc'), coords = sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].xyz}) if IsControlJustPressed(0, 38) then TaskLeaveVehicle(NpcData.Npc, cache.vehicle, 0) SetEntityAsMissionEntity(NpcData.Npc, false, true) @@ -532,7 +532,7 @@ RegisterNetEvent('qb-taxi:client:DoTaxiNpc', function() DrawMarker(2, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].x, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].y, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.3, 255, 255, 255, 255, false, false, 0, true, nil, nil, false) if dist < 5 then - DrawText3D(sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].x, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].y, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].z, Lang:t('info.call_npc')) + qbx.drawText3d({text = Lang:t('info.call_npc'), coords = sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].xyz}) if IsControlJustPressed(0, 38) then local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(cache.vehicle), 0 diff --git a/fxmanifest.lua b/fxmanifest.lua index bfbd5f9..d41aeb0 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -7,7 +7,7 @@ version '1.0.0' shared_scripts { '@ox_lib/init.lua', - '@qbx_core/modules/utils.lua', + '@qbx_core/modules/lib.lua', '@qbx_core/shared/locale.lua', 'locales/en.lua', 'locales/*.lua' diff --git a/server/main.lua b/server/main.lua index e6561e0..e457e05 100644 --- a/server/main.lua +++ b/server/main.lua @@ -13,10 +13,11 @@ local function nearTaxi(src) end lib.callback.register('qb-taxi:server:spawnTaxi', function(source, model, coords) - local netId = SpawnVehicle(source, model, coords, true) - if not netId or netId == 0 then return end - local veh = NetworkGetEntityFromNetworkId(netId) - if not veh or veh == 0 then return end + local netId, veh = qbx.spawnVehicle({ + model = model, + spawnSource = coords, + warp = GetPlayerPed(source --[[@as number]]), + }) local plate = 'TAXI' .. math.random(1000, 9999) SetVehicleNumberPlateText(veh, plate)