-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.lua
349 lines (262 loc) · 11.4 KB
/
interface.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
local x, y = guiGetScreenSize()
m1 = 500
m2 = 240
Lbase = {}
function findWindow(unpackData)
showCursor(true)
windowFindH = guiCreateWindow(x/2-(m1/2),y/2-(m2/2),m1,m2, "Список игроков фракции", false)
GridHeals = guiCreateGridList(10, 29, 490, 160, false, windowFindH)
guiGridListAddColumn(GridHeals, " ID", 0.1)
guiGridListAddColumn(GridHeals, "Имя", 0.275)
guiGridListAddColumn(GridHeals, "Должность", 0.25)
guiGridListAddColumn(GridHeals, "Смена", 0.16)
guiGridListAddColumn(GridHeals, "Статус", 0.15)
guiGridListClear(GridHeals)
HealCloseButton = guiCreateButton(10, 210, 490, 22, "Закрыть", false, windowFindH)
-- ◊ ◈ □ ■ ▪ ▫
for key, value in pairs( unpackData ) do
table.insert(Lbase, {value[key]})
local row = guiGridListAddRow(GridHeals)
guiGridListSetItemText(GridHeals, row, 2,' '..value[2], false, false)
for i,v in ipairs(rangs) do
if i == value[4] then
guiGridListSetItemText(GridHeals, row, 3,' ['..v..']', false, false)
end
if not value[3] == false then
local dat1 = getElementData(value[3],"ID") or "-"
guiGridListSetItemText(GridHeals, row, 1,'('..dat1..')', false, false)
else
guiGridListSetItemText(GridHeals, row, 1,' -', false, false)
end
if not value[3] == false then
guiGridListSetItemText(GridHeals, row, 5,' online', false, false)
guiGridListSetItemColor ( GridHeals, row, 5, 0,255,0 )
else
guiGridListSetItemText(GridHeals, row, 5,' offline', false, false)
guiGridListSetItemColor ( GridHeals, row, 5, 150,150,150 )
guiGridListSetItemText(GridHeals, row,4," сдал(а)", false, false)
guiGridListSetItemColor ( GridHeals, row, 4, 255,0,0 )
end
if not value[3] == false then
local dat2 = getElementData(value[3],"smena-Heal") or "сдал(а)"
if dat2 == "сдал(а)" then
guiGridListSetItemText(GridHeals, row,4,' '..dat2, false, false)
guiGridListSetItemColor ( GridHeals, row, 4, 255,0,0 )
elseif dat2 == "работает" then
guiGridListSetItemText(GridHeals, row,4,' '..dat2, false, false)
guiGridListSetItemColor ( GridHeals, row, 4, 0,255,0 )
end
end
end
end
-- 1 логин игрока
-- 2 Никнейм
-- 3 Указатель на игрока
-- 4 Ранг
-- 5 состояние работы (не отпровляем т.к лучше искать на клиенте)
---------------------------------------------------------------------------------------------
guiWindowSetSizable(windowFindH, false)
guiSetFont(HealCloseButton, "default-bold-small")
guiSetProperty(HealCloseButton, "NormalTextColour", "FFFF0000")
end
function opWindows(unpackData)
if isElement(windowFindH) then
else
findWindow(unpackData)
end
end
addEvent( "windowFindH", true )
addEventHandler( "windowFindH", localPlayer, opWindows )
function closeFind(button,state)
if button == "left" and state == "up" then
if source == HealCloseButton then
destroyElement(windowFindH)
showCursor(false)
end
end
end
addEventHandler("onClientGUIClick",resourceRoot,closeFind)
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
m3 = 350
m4 = 125
statka = false
function jobmedic(hitPlayer)
if hitPlayer == getLocalPlayer() then return end
if statka == false then
statka = true
showCursor(true)
main = guiCreateWindow(x/2-(m3/2),y/2-(m4/2),m3,m4, "Выберите действие", false)
if getElementData(getLocalPlayer(),'smena-Heal') == "сдал(а)" then
btns = guiCreateButton(10, 90, 130, 25, "Заступить на смену", false, main)
guiSetFont(btns, "default-bold-small")
guiSetProperty(btns, "NormalTextColour", "FF00defd")
elseif getElementData(getLocalPlayer(),'smena-Heal') == "работает" then
btns = guiCreateButton(10, 90, 130, 25, "Закончить на смену", false, main)
guiSetFont(btns, "default-bold-small")
guiSetProperty(btns, "NormalTextColour", "FFaf7c00")
end
close = guiCreateButton(210, 90, 130, 25, "Закрыть", false, main)
guiWindowSetSizable(main, false)
guiSetFont(close, "default-bold-small")
guiSetProperty(close, "NormalTextColour", "FFFF0000")
end
end
addEvent( "okeyJob", true )
addEventHandler( "okeyJob", localPlayer, jobmedic )
function cls()
if isElement(main) then
destroyElement(main)
statka = false
showCursor(false)
end
end
function getJobState(user)
local data = getElementData(getLocalPlayer(),'smena-Heal') or nil
if data == 'сдал(а)' then
return false
elseif data == 'работает' then
return true
end
end
function closeFind(button,state)
if button == "left" and state == "up" then
if source == btns then
cls()
if getJobState() == false then
triggerServerEvent ( "goJob", resourceRoot, getLocalPlayer() )
elseif getJobState() == true then
triggerServerEvent ( "stopJob", resourceRoot, getLocalPlayer() )
end
elseif source == close then
cls()
end
end
end
addEventHandler("onClientGUIClick",resourceRoot,closeFind)
-- function Renderds()
-- local data = getElementData(getLocalPlayer(),'smena-Heal') or 0
-- dxDrawText (data, x/2,y/2,x/2,y/2, tocolor(255,255,255),1, f.text,"center" )
-- end
-- addEventHandler ( "onClientRender", root,Renderds)
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
myFont = guiCreateFont( "font.ttf", 10.5)
function createAcceptWindowMeDICK(userId,message,ThePlayer)
if not userId == getLocalPlayer() then return end
winn = guiCreateWindow((x - 407) / 2, (y - 159) / 2, 407, 159, "Оплата медикоментов.", false)
guiSetProperty(winn, "CaptionColour", "FFEC5412")
guiWindowSetSizable(winn, false)
clOplata = guiCreateButton(255, 109, 120, 33, "Отменить", false, winn)
guiSetProperty(clOplata, "NormalTextColour", "FFED1010")
okOplata = guiCreateButton(35, 109, 120, 33, "Оплатить", false, winn)
guiSetProperty(okOplata, "NormalTextColour", "FF2CE01E")
labels = guiCreateLabel(38, 36, 330, 63, "Игрок "..ThePlayer..", предлагает вам \n \""..message.."\",\n за "..mTK.." рублей.", false, winn)
guiSetFont(labels, myFont)
guiSetFont(clOplata, myFont)
guiSetFont(okOplata, myFont)
guiLabelSetHorizontalAlign(labels, "center", false)
guiLabelSetVerticalAlign(labels, "center")
guiSetInputMode("no_binds")
end
function Opppa1(userId,message,ThePlayer)
if not isElement(winn) then
showCursor(true)
createAcceptWindowMeDICK(userId,message,ThePlayer)
end
end
addEvent( "MsgWinHeal", true )
addEventHandler( "MsgWinHeal", localPlayer, Opppa1 )
function fnClose()
if isElement(winn) then
destroyElement(winn)
end
guiSetInputMode("allow_binds")
showCursor(false)
end
function clickOff(button,state) -- Скрытие окна
if button == "left" and state == "up" then
if source == clOplata then
fnClose()
elseif source == okOplata then
fnClose()
local mybabki = getPlayerMoney ()
if (mybabki >= mTK) then
triggerServerEvent ( "healPedik", resourceRoot,getLocalPlayer())
else
outputChatBox("У вас не хватает денег",255,0,0)
end
end
end
end
addEventHandler("onClientGUIClick",resourceRoot,clickOff)
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
local px = x/x
fontik = {
text = guiCreateFont("font.ttf", 8*px, false, "antialiased"),
}
function pipUser(user,AttUser)
if user then
pipPlayer = user
else
user = nil
end
if AttUser then
ThePlayer = AttUser
end
invites()
end
addEvent( "pipUser", true )
addEventHandler( "pipUser", localPlayer, pipUser )
-- pipUser()
function invites()
-- showCursor(true)
winAccepts = guiCreateWindow((x - 350) / 2, (y - 110) / 2, 350, 110, "Вступить в фракцию "..FracGlobalNameChat.."?", false)
guiSetProperty(winAccepts, "CaptionColour", "FF2CE01E")
guiWindowSetSizable(winAccepts, false)
aFrac = guiCreateButton(0, 75, 120, 30, "Вступить", false, winAccepts)
guiSetProperty(aFrac, "NormalTextColour", "FF2CE01E")
nFrac = guiCreateButton(215, 75, 120, 30, "Отказаться", false, winAccepts)
guiSetProperty(nFrac, "NormalTextColour", "FFED1010")
guiSetFont(aFrac, fontik.text)
guiSetFont(nFrac, fontik.text)
guiSetInputMode("no_binds")
end
-- invites()
function Adest()
if isElement(winAccepts) then
destroyElement(winAccepts)
end
local currentState = isCursorShowing ()
local oppositeState = currentState
guiSetInputMode("allow_binds")
showCursor ( oppositeState )
end
addEventHandler("onClientResourceStop",root,Adest)
function iClick(button,state)
if button == "left" and state == "up" then
if source == nFrac then
--------------
Adest()
-----------------------------------------------------------------
elseif source == aFrac then
-----------------------------------------------------------------
if ThePlayer then
if pipPlayer == nil then return end
local tostr = getElementData(getLocalPlayer(),"ID") or nil
if not tostr == nil then return end
local encodedString = teaEncode(tostr, 14882020666777 )
triggerServerEvent ( "hachukaPizza", resourceRoot, encodedString,ThePlayer)
Adest()
--------------
end
end
end
end
addEventHandler("onClientGUIClick",resourceRoot,iClick)