-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.lua
More file actions
52 lines (47 loc) · 1.48 KB
/
Copy pathclient.lua
File metadata and controls
52 lines (47 loc) · 1.48 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
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('tm1_getcoords')
AddEventHandler('tm1_getcoords', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local codeA = "{x = "..round(x,2)..", y = "..round(y,2)..", z = "..round(z,2).."},"
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'codemenu',
{
title = "Nombre"
},
function(data, menu)
local name = data.value
TriggerServerEvent('tm1_getcoords:print', name.." : "..codeA)
menu.close()
end,
function(data, menu)
menu.close()
end)
end)
RegisterNetEvent('tm1_getcoords1')
AddEventHandler('tm1_getcoords1', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local codeA = round(x,2)..", "..round(y,2)..", "..round(z,2)
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'codemenu',
{
title = "Nombre"
},
function(data, menu)
local name = data.value
TriggerServerEvent('tm1_getcoords:print', name.." : "..codeA)
menu.close()
end,
function(data, menu)
menu.close()
end)
end)
function round(num, numDecimalPlaces)
local mult = 5^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end