Skip to content

Commit

Permalink
🐛 fix drawtext3d coords (#16)
Browse files Browse the repository at this point in the history
* fix drawtext3d coords

* refactor(server/main): use qbx.spawnVehicle

* fix(server/main): return netId

---------

Co-authored-by: solareon <769465+solareon@users.noreply.github.com>
  • Loading branch information
ArturMichalak and solareon authored Apr 6, 2024
1 parent 4a67db3 commit 4ad4a22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
9 changes: 5 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4ad4a22

Please sign in to comment.