-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.lua
More file actions
115 lines (96 loc) · 3.17 KB
/
Copy pathclient.lua
File metadata and controls
115 lines (96 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
local showPlayerBlips = false
local ignorePlayerNameDistance = false
local playerNamesDist = 15
local displayIDHeight = 1.5 --Height of ID above players head(starts at center body mass)
--Set Default Values for Colors
local red = 255
local green = 255
local blue = 255
function DrawText3D(x,y,z, text)
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
local scale = (1/dist)*2
local fov = (1/GetGameplayCamFov())*100
local scale = scale*fov
if onScreen then
SetTextScale(0.0*scale, 0.55*scale)
SetTextFont(0)
SetTextProportional(1)
SetTextColour(red, green, blue, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
World3dToScreen2d(x,y,z, 0) --Added Here
DrawText(_x,_y)
end
end
Citizen.CreateThread(function ()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
PlayerData = ESX.GetPlayerData()
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
--You can change or add for other whitelisted JOB police , mech and ambulance
if IsControlPressed(1, 19) and PlayerData.job.name == 'ambulance' then
for i=0,99 do
N_0x31698aa80e0223f8(i)
end
for id = 0, 31 do
if ((NetworkIsPlayerActive( id )) and GetPlayerPed( id ) ~= GetPlayerPed( -1 )) then
ped = GetPlayerPed( id )
blip = GetBlipFromEntity( ped )
x1, y1, z1 = table.unpack( GetEntityCoords( GetPlayerPed( -1 ), true ) )
x2, y2, z2 = table.unpack( GetEntityCoords( GetPlayerPed( id ), true ) )
distance = math.floor(GetDistanceBetweenCoords(x1, y1, z1, x2, y2, z2, true))
if(ignorePlayerNameDistance) then
if NetworkIsPlayerTalking(id) then
red = 0
green = 0
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
else
red = 255
green = 255
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
end
end
if ((distance < playerNamesDist)) then
if not (ignorePlayerNameDistance) then
if NetworkIsPlayerTalking(id) then
red = 0
green = 0
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
else
red = 255
green = 255
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
end
end
end
end
end
elseif not IsControlPressed(1, 19) then
DrawText3D(0, 0, 0, "")
end
end
end)