-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
132 lines (97 loc) · 3.27 KB
/
client.lua
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
RegisterCommand('tpm', function(source, args, raw)
local playerPed = PlayerPedId()
local waypoint = GetFirstBlipInfoId(8)
local waypointCoords = GetBlipInfoIdCoord(waypoint)
SetEntityCoords(playerPed, waypointCoords.x, waypointCoords.y, waypointCoords.z+35)
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(10000)
print('do')
TriggerEvent('skinchanger:getSkin', function(skinData)
if skinData ~= nil then
if skinData['beard_2'] > -1 and skinData['beard_2'] < 10 then
skinData['beard_2'] = skinData['beard_2'] + 1
TriggerEvent('skinchanger:loadSkin', skinData)
TriggerServerEvent('esx_skin:save', skinData)
end
end
end)
end
end)
Citizen.CreateThread(function()
while true do
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local distance = Vdist(playerCoords, Config.Destination.x, Config.Destination.y, Config.Destination.z)
if IsControlJustReleased(0, 38) then
if distance < 3.0 then
ShowNotification('ja')
else
ShowNotification('nein')
end
end
Citizen.Wait(1)
end
end)
function ShowNotification(text)
SetNotificationTextEntry('STRING')
AddTextComponentString(text)
DrawNotification(false, true)
end
_menuPool = NativeUI.CreatePool()
local mainMenu
Citizen.CreateThread(function()
while true do
_menuPool:ProcessMenus()
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local distance = Vdist(playerCoords, Config.Destination.x, Config.Destination.y, Config.Destination.z)
if IsControlJustReleased(0, 38) then
if distance < 3.0 then
openMenu()
ShowNotification('ja')
else
ShowNotification('nein')
end
end
Citizen.Wait(1)
end
end)
function openMenu()
mainMenu = NativeUI.CreateMenu('Title', 'Beschreibung')
_menuPool:Add(mainMenu)
local testItem = NativeUI.CreateItem('Name', 'Desc')
mainMenu:AddItem(testItem)
mainMenu.OnItemSelect = function(sender, item, index)
if item == testItem then
ShowNotification('pressed')
end
end
testItem.Activated = function(sender, index)
ShowNotification('gedrückt')
end
mainMenu:Visible(true)
_menuPool:MouseEdgeEnabled(false)
end
function ShowNotification(text)
SetNotificationTextEntry('STRING')
AddTextComponentString(text)
DrawNotification(false, true)
end
RegisterCommand('broadcast', function(source, args, raw)
local finalString = ''
for i=1, #args, 1 do
finalString = finalString .. ' ' .. args[i]
end
TriggerServerEvent('bc:get', finalString)
end, false)
RegisterNetEvent('bc:send')
AddEventHandler('bc:send', function(finalString)
ShowNotification(finalString)
end)
function ShowNotification(text)
SetNotificationTextEntry('STRING')
AddTextComponentString(text)
DrawNotification(false, true)
end