Skip to content

Commit

Permalink
Fixed per player issue
Browse files Browse the repository at this point in the history
Fixed issue where it would show the hud for everyone once 1 person is in the vehicle.
  • Loading branch information
Codi Bezouka-Smith committed Jun 15, 2019
1 parent e32278f commit a3dad7f
Showing 1 changed file with 25 additions and 41 deletions.
66 changes: 25 additions & 41 deletions streetLabel/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,28 @@ function drawTxt2(x,y ,width,height,scale, text, r,g,b,a)
end
end

if (checkForVehicle == false) then
local directions = { [0] = 'N', [45] = 'NW', [90] = 'W', [135] = 'SW', [180] = 'S', [225] = 'SE', [270] = 'E', [315] = 'NE', [360] = 'N', }
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local pos = GetEntityCoords(PlayerPedId())
local var1, var2 = GetStreetNameAtCoord(pos.x, pos.y, pos.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
local current_zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))
for k,v in pairs(directions)do
direction = GetEntityHeading(PlayerPedId())
if(math.abs(direction - k) < 22.5)then
direction = v
break
end
local directions = { [0] = 'N', [45] = 'NW', [90] = 'W', [135] = 'SW', [180] = 'S', [225] = 'SE', [270] = 'E', [315] = 'NE', [360] = 'N', }
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)

local ped = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(ped, false)
local directions = { [0] = 'N', [45] = 'NW', [90] = 'W', [135] = 'SW', [180] = 'S', [225] = 'SE', [270] = 'E', [315] = 'NE', [360] = 'N', }

local pos = GetEntityCoords(PlayerPedId())
local var1, var2 = GetStreetNameAtCoord(pos.x, pos.y, pos.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
local current_zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))

for k,v in pairs(directions)do
direction = GetEntityHeading(PlayerPedId())
if(math.abs(direction - k) < 22.5)then
direction = v
break
end

end

if (checkForVehicle == false) then
if GetStreetNameFromHashKey(var1) and GetNameOfZone(pos.x, pos.y, pos.z) then
if GetStreetNameFromHashKey(var1) then
if direction == 'N' then
Expand Down Expand Up @@ -131,30 +137,8 @@ if (checkForVehicle == false) then
end
end
end
end
end)
else
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)

local ped = GetPlayerPed()
local vehicle = GetVehiclePedIsIn(ped, false)
local directions = { [0] = 'N', [45] = 'NW', [90] = 'W', [135] = 'SW', [180] = 'S', [225] = 'SE', [270] = 'E', [315] = 'NE', [360] = 'N', }

-- if vehicle exists
if vehicle ~= 0 then
local pos = GetEntityCoords(PlayerPedId())
local var1, var2 = GetStreetNameAtCoord(pos.x, pos.y, pos.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
local current_zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))
for k,v in pairs(directions)do
direction = GetEntityHeading(PlayerPedId())
if(math.abs(direction - k) < 22.5)then
direction = v
break
end
end

else
if (vehicle ~= 0) then
if GetStreetNameFromHashKey(var1) and GetNameOfZone(pos.x, pos.y, pos.z) then
if GetStreetNameFromHashKey(var1) then
if direction == 'N' then
Expand Down Expand Up @@ -242,5 +226,5 @@ else
end
end
end
end)
end
end
end)

0 comments on commit a3dad7f

Please sign in to comment.