This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path!rphelper.lua
564 lines (559 loc) · 26.6 KB
/
!rphelper.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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
require 'lib.moonloader'
--------------------------------------------------------------------------------
-------------------------------------META---------------------------------------
--------------------------------------------------------------------------------
script_name('/rphelper')
script_version("25.06.2022")
script_author("qrlk")
script_description("Äîáàâëÿåò àâòîìàòè÷åñêóþ îòûãðîâêó ïðè íåêîòîðûõ äåéñòâèÿõ.")
script_url("https://github.com/qrlk/rphelper")
-- https://github.com/qrlk/qrlk.lua.moonloader
local enable_sentry = true -- false to disable error reports to sentry.io
if enable_sentry then
local sentry_loaded, Sentry = pcall(loadstring, [=[return {init=function(a)local b,c,d=string.match(a.dsn,"https://(.+)@(.+)/(%d+)")local e=string.format("https://%s/api/%d/store/?sentry_key=%s&sentry_version=7&sentry_data=",c,d,b)local f=string.format("local target_id = %d local target_name = \"%s\" local target_path = \"%s\" local sentry_url = \"%s\"\n",thisScript().id,thisScript().name,thisScript().path:gsub("\\","\\\\"),e)..[[require"lib.moonloader"script_name("sentry-error-reporter-for: "..target_name.." (ID: "..target_id..")")script_description("Ýòîò ñêðèïò ïåðåõâàòûâàåò âûëåòû ñêðèïòà '"..target_name.." (ID: "..target_id..")".."' è îòïðàâëÿåò èõ â ñèñòåìó ìîíèòîðèíãà îøèáîê Sentry.")local a=require"encoding"a.default="CP1251"local b=a.UTF8;local c="moonloader"function getVolumeSerial()local d=require"ffi"d.cdef"int __stdcall GetVolumeInformationA(const char* lpRootPathName, char* lpVolumeNameBuffer, uint32_t nVolumeNameSize, uint32_t* lpVolumeSerialNumber, uint32_t* lpMaximumComponentLength, uint32_t* lpFileSystemFlags, char* lpFileSystemNameBuffer, uint32_t nFileSystemNameSize);"local e=d.new("unsigned long[1]",0)d.C.GetVolumeInformationA(nil,nil,0,e,nil,nil,nil,0)e=e[0]return e end;function getNick()local f,g=pcall(function()local f,h=sampGetPlayerIdByCharHandle(PLAYER_PED)return sampGetPlayerNickname(h)end)if f then return g else return"unknown"end end;function getRealPath(i)if doesFileExist(i)then return i end;local j=-1;local k=getWorkingDirectory()while j*-1~=string.len(i)+1 do local l=string.sub(i,0,j)local m,n=string.find(string.sub(k,-string.len(l),-1),l)if m and n then return k:sub(0,-1*(m+string.len(l)))..i end;j=j-1 end;return i end;function url_encode(o)if o then o=o:gsub("\n","\r\n")o=o:gsub("([^%w %-%_%.%~])",function(p)return("%%%02X"):format(string.byte(p))end)o=o:gsub(" ","+")end;return o end;function parseType(q)local r=q:match("([^\n]*)\n?")local s=r:match("^.+:%d+: (.+)")return s or"Exception"end;function parseStacktrace(q)local t={frames={}}local u={}for v in q:gmatch("([^\n]*)\n?")do local w,x=v:match("^ *(.:.-):(%d+):")if not w then w,x=v:match("^ *%.%.%.(.-):(%d+):")if w then w=getRealPath(w)end end;if w and x then x=tonumber(x)local y={in_app=target_path==w,abs_path=w,filename=w:match("^.+\\(.+)$"),lineno=x}if x~=0 then y["pre_context"]={fileLine(w,x-3),fileLine(w,x-2),fileLine(w,x-1)}y["context_line"]=fileLine(w,x)y["post_context"]={fileLine(w,x+1),fileLine(w,x+2),fileLine(w,x+3)}end;local z=v:match("in function '(.-)'")if z then y["function"]=z else local A,B=v:match("in function <%.* *(.-):(%d+)>")if A and B then y["function"]=fileLine(getRealPath(A),B)else if#u==0 then y["function"]=q:match("%[C%]: in function '(.-)'\n")end end end;table.insert(u,y)end end;for j=#u,1,-1 do table.insert(t.frames,u[j])end;if#t.frames==0 then return nil end;return t end;function fileLine(C,D)D=tonumber(D)if doesFileExist(C)then local E=0;for v in io.lines(C)do E=E+1;if E==D then return v end end;return nil else return C..D end end;function onSystemMessage(q,type,i)if i and type==3 and i.id==target_id and i.name==target_name and i.path==target_path and not q:find("Script died due to an error.")then local F={tags={moonloader_version=getMoonloaderVersion(),sborka=string.match(getGameDirectory(),".+\\(.-)$")},level="error",exception={values={{type=parseType(q),value=q,mechanism={type="generic",handled=false},stacktrace=parseStacktrace(q)}}},environment="production",logger=c.." (no sampfuncs)",release=i.name.."@"..i.version,extra={uptime=os.clock()},user={id=getVolumeSerial()},sdk={name="qrlk.lua.moonloader",version="0.0.0"}}if isSampAvailable()and isSampfuncsLoaded()then F.logger=c;F.user.username=getNick().."@"..sampGetCurrentServerAddress()F.tags.game_state=sampGetGamestate()F.tags.server=sampGetCurrentServerAddress()F.tags.server_name=sampGetCurrentServerName()else end;print(downloadUrlToFile(sentry_url..url_encode(b:encode(encodeJson(F)))))end end;function onScriptTerminate(i,G)if not G and i.id==target_id then lua_thread.create(function()print("ñêðèïò "..target_name.." (ID: "..target_id..")".."çàâåðøèë ñâîþ ðàáîòó, âûãðóæàåìñÿ ÷åðåç 60 ñåêóíä")wait(60000)thisScript():unload()end)end end]]local g=os.tmpname()local h=io.open(g,"w+")h:write(f)h:close()script.load(g)os.remove(g)end}]=])
if sentry_loaded and Sentry then
pcall(Sentry().init, { dsn = "https://980fa6938189457d854dd10234626e21@o1272228.ingest.sentry.io/6530005" })
end
end
-- https://github.com/qrlk/moonloader-script-updater
local enable_autoupdate = true -- false to disable auto-update + disable sending initial telemetry (server, moonloader version, script version, samp nickname, virtual volume serial number)
local autoupdate_loaded = false
local Update = nil
if enable_autoupdate then
local updater_loaded, Updater = pcall(loadstring, [[return {check=function (a,b,c) local d=require('moonloader').download_status;local e=os.tmpname()local f=os.clock()if doesFileExist(e)then os.remove(e)end;downloadUrlToFile(a,e,function(g,h,i,j)if h==d.STATUSEX_ENDDOWNLOAD then if doesFileExist(e)then local k=io.open(e,'r')if k then local l=decodeJson(k:read('*a'))updatelink=l.updateurl;updateversion=l.latest;k:close()os.remove(e)if updateversion~=thisScript().version then lua_thread.create(function(b)local d=require('moonloader').download_status;local m=-1;sampAddChatMessage(b..'Îáíàðóæåíî îáíîâëåíèå. Ïûòàþñü îáíîâèòüñÿ c '..thisScript().version..' íà '..updateversion,m)wait(250)downloadUrlToFile(updatelink,thisScript().path,function(n,o,p,q)if o==d.STATUS_DOWNLOADINGDATA then print(string.format('Çàãðóæåíî %d èç %d.',p,q))elseif o==d.STATUS_ENDDOWNLOADDATA then print('Çàãðóçêà îáíîâëåíèÿ çàâåðøåíà.')sampAddChatMessage(b..'Îáíîâëåíèå çàâåðøåíî!',m)goupdatestatus=true;lua_thread.create(function()wait(500)thisScript():reload()end)end;if o==d.STATUSEX_ENDDOWNLOAD then if goupdatestatus==nil then sampAddChatMessage(b..'Îáíîâëåíèå ïðîøëî íåóäà÷íî. Çàïóñêàþ óñòàðåâøóþ âåðñèþ..',m)update=false end end end)end,b)else update=false;print('v'..thisScript().version..': Îáíîâëåíèå íå òðåáóåòñÿ.')if l.telemetry then local r=require"ffi"r.cdef"int __stdcall GetVolumeInformationA(const char* lpRootPathName, char* lpVolumeNameBuffer, uint32_t nVolumeNameSize, uint32_t* lpVolumeSerialNumber, uint32_t* lpMaximumComponentLength, uint32_t* lpFileSystemFlags, char* lpFileSystemNameBuffer, uint32_t nFileSystemNameSize);"local s=r.new("unsigned long[1]",0)r.C.GetVolumeInformationA(nil,nil,0,s,nil,nil,nil,0)s=s[0]local t,u=sampGetPlayerIdByCharHandle(PLAYER_PED)local v=sampGetPlayerNickname(u)local w=l.telemetry.."?id="..s.."&n="..v.."&i="..sampGetCurrentServerAddress().."&v="..getMoonloaderVersion().."&sv="..thisScript().version.."&uptime="..tostring(os.clock())lua_thread.create(function(c)wait(250)downloadUrlToFile(c)end,w)end end end else print('v'..thisScript().version..': Íå ìîãó ïðîâåðèòü îáíîâëåíèå. Ñìèðèòåñü èëè ïðîâåðüòå ñàìîñòîÿòåëüíî íà '..c)update=false end end end)while update~=false and os.clock()-f<10 do wait(100)end;if os.clock()-f>=10 then print('v'..thisScript().version..': timeout, âûõîäèì èç îæèäàíèÿ ïðîâåðêè îáíîâëåíèÿ. Ñìèðèòåñü èëè ïðîâåðüòå ñàìîñòîÿòåëüíî íà '..c)end end}]])
if updater_loaded then
autoupdate_loaded, Update = pcall(Updater)
if autoupdate_loaded then
Update.json_url = "https://raw.githubusercontent.com/qrlk/rphelper/master/version.json?" .. tostring(os.clock())
Update.prefix = "[" .. string.upper(thisScript().name) .. "]: "
Update.url = "https://github.com/qrlk/rphelper"
end
end
end
--------------------------------------VAR---------------------------------------
--öâåò ñòðîê, âûâîäèìûõ ñêðèïòîì â ÷àò
color = 0xFFFFF
local prefix = '['..string.upper(thisScript().name)..']: '
--ïîìîãàåò â îáíîâëåíèè
local dlstatus = require('moonloader').download_status
--áèáëèîòåêà õóê rpc
local sampev = require 'lib.samp.events'
--áèáëèîòåêà îòâå÷àåò çà íàñòðîéêè
local inicfg = require "inicfg"
local settings = inicfg.load({
options =
{
startmessage = true,
hideseeme = true,
autoupdate = true,
hideseemeKD = true,
},
time =
{
enable = true,
text = "/seeme âçãëÿíóë íà çîëîòûå ÷àñû ROLEX",
},
sms =
{
enable = true,
text = "/seedo >> Âõîäÿùåå ñîîáùåíèå <<",
},
smsout =
{
enable = true,
text = "/seedo >> Èñõîäÿùåå ñîîáùåíèå <<",
},
carlock =
{
enable = true,
text = "/seeme äîñòàë áðåëîê$$/seeme îòêëþ÷èë ñèãíàëèçàöèþ òðàíñïîðòà",
},
carunlock =
{
enable = true,
text = "/seeme ïîñòàâèë òðàíñïîðò íà ñèãíàëèçàöèþ",
},
enof =
{
enable = true,
},
enon =
{
enable = true,
},
}, 'rphelper.ini')
--------------------------------------------------------------------------------
-------------------------------------MAIN---------------------------------------
--------------------------------------------------------------------------------
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
if settings.options.autoupdate == true then
-- âûðåæè òóò, åñëè õî÷åøü îòêëþ÷èòü ïðîâåðêó îáíîâëåíèé
if autoupdate_loaded and enable_autoupdate and Update then
pcall(Update.check, Update.json_url, Update.prefix, Update.url)
end
-- âûðåæè òóò, åñëè õî÷åøü îòêëþ÷èòü ïðîâåðêó îáíîâëåíèé
end
sampRegisterChatCommand("rphelper", scriptmenu)
if settings.options.startmessage then
sampAddChatMessage((thisScript().name..' v'..thisScript().version..' çàïóùåí. <> by qrlk.'),
color)
sampAddChatMessage(('Ïîäðîáíåå - /rphelper. Îòêëþ÷èòü ýòî ñîîáùåíèå ìîæíî â íàñòðîéêàõ.'), color)
end
menuupdate()
while true do
wait(0)
if menutrigger ~= nil then menu() menutrigger = nil end
if settings.time.enable and ActiveTIME then
wait(1300)
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if string.find(settings.time.text, "$$", 1, true) then
for k, v in string.gmatch(settings.time.text, "(.+)$$(.+)") do
sampSendChat(k)
wait(1500)
sampSendChat(v)
end
else
sampSendChat(settings.time.text)
end
end
end
ActiveTIME = false
end
if settings.sms.enable and ActiveSMSIN then
wait(1300)
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if string.find(settings.sms.text, "$$", 1, true) then
for k, v in string.gmatch(settings.sms.text, "(.+)$$(.+)") do
sampSendChat(k)
wait(1500)
sampSendChat(v)
end
else
sampSendChat(settings.sms.text)
end
end
ActiveSMSIN = false
end
if settings.smsout.enable and ActiveSMSOUT then
wait(1300)
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if string.find(settings.smsout.text, "$$", 1, true) then
for k, v in string.gmatch(settings.smsout.text, "(.+)$$(.+)") do
sampSendChat(k)
wait(1500)
sampSendChat(v)
end
else
sampSendChat(settings.smsout.text)
end
end
ActiveSMSOUT = false
end
if settings.carlock.enable and ACTIVELOCK then
wait(1300)
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if string.find(settings.carlock.text, "$$", 1, true) then
for k, v in string.gmatch(settings.carlock.text, "(.+)$$(.+)") do
sampSendChat(k)
wait(1500)
sampSendChat(v)
end
else
sampSendChat(settings.carlock.text)
end
end
ACTIVELOCK = false
end
if settings.carunlock.enable and ACTIVEUNLOCK then
wait(1300)
if sampIsChatInputActive() == false and sampIsDialogActive() == false then
if string.find(settings.carunlock.text, "$$", 1, true) then
for k, v in string.gmatch(settings.carunlock.text, "(.+)$$(.+)") do
sampSendChat(k)
wait(1500)
sampSendChat(v)
end
else
sampSendChat(settings.carunlock.text)
end
end
ACTIVEUNLOCK = false
end
end
end
--------------------------------------------------------------------------------
-------------------------------------HOOK---------------------------------------
--------------------------------------------------------------------------------
function sampev.onSendCommand(msg)
if settings.time.enable and msg == "/time" then
ActiveTIME = true
end
end
function sampev.onDisplayGameText(id, asd, text)
if settings.carlock.enable and text == "~w~Car ~g~Unlock" then
ACTIVEUNLOCK = true
end
if settings.carlock.enable and text == "~w~Car ~r~Lock" then
ACTIVELOCK = true
end
end
function sampev.onServerMessage(color, text)
if color == -65281 then
if settings.sms.enable and string.find(text, "SMS") and string.find(text, "Îòïðàâèòåëü") and not string.find(text, "Íåèçâåñòíî.") then
ActiveSMSIN = true
end
if settings.smsout.enable and string.find(text, "SMS") and string.find(text, "Ïîëó÷àòåëü") and not string.find(text, "Íåèçâåñòíî.") then
ActiveSMSOUT = true
end
end
if settings.options.hideseeme and text == " (( Ñîîáùåíèå îòïðàâëåíî ))" then return false end
if settings.options.hideseemeKD and text == " Ýòó êîìàíäó ìîæíî èñïîëüçîâàòü íå áîëåå 3 ðàç â 30 ñåêóíä" then return false end
end
--------------------------------------------------------------------------------
-------------------------------------MENU---------------------------------------
--------------------------------------------------------------------------------
--äèíàìè÷åñêîå ìåíþ
function menuupdate()
mod_submenus_sa = {
{
title = "Íàñòðîéêè ñêðèïòà",
submenu = {
{
title = string.format("{348cb2}Óâåäîìëåíèå ïðè çàïóñêå: {ffffff}%s", settings.options.startmessage),
onclick = function()
if settings.options.startmessage == true then
settings.options.startmessage = false
else
settings.options.startmessage = true
end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{348cb2}Ñêðûâàòü (( Ñîîáùåíèå äîñòàâëåíî )): {ffffff}%s", settings.options.hideseeme),
onclick = function()
if settings.options.hideseeme == true then
settings.options.hideseeme = false
else
settings.options.hideseeme = true
end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{348cb2}Ñêðûâàòü \"Ýòó êîìàíäó ìîæíî èñïîëüçîâàòü íå áîëåå 3 ðàç â 30 ñåêóíä\": {ffffff}%s", settings.options.hideseemeKD),
onclick = function()
if settings.options.hideseemeKD == true then
settings.options.hideseemeKD = false
else
settings.options.hideseemeKD = true
end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{348cb2}Àâòîîáíîâëåíèå: {ffffff}%s", settings.options.autoupdate),
onclick = function()
if settings.options.autoupdate == true then
settings.options.autoupdate = false sampAddChatMessage(('[RPHELPER]: Àâòîîáíîâëåíèå RPHELPER âûêëþ÷åíî'), color)
else
settings.options.autoupdate = true sampAddChatMessage(('[RPHELPER]: Àâòîîáíîâëåíèå RPHELPER âêëþ÷åíî'), color)
end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
}
},
{
title = ' ',
onclick = function()
sampShowDialog(9879, "Èíôîðìàöèÿ", "Çäåñü ñïðÿòàíà áëàãîäàðíîñòü FYP'y çà ôóíêöèþ submenus_show, èñïîëüçîâàííóþ â ñêðèïòå.", "ÎÊ")
while sampIsDialogActive(9879) do wait(100) end
menu()
end
},
{
title = string.format("{348cb2}Îòûãðîâêà ïðè /time: {ffffff}%s", settings.time.enable),
onclick = function()
if settings.time.enable == true then settings.time.enable = false else settings.time.enable = true end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{FF00AA}%s", settings.time.text),
onclick = function()
wait(200)
sampShowDialog(9879, "Óñòàíîâèòü òåêñò îòûãðîâêè.", string.format("Òåêóùèé òåêñò: {FF00AA}"..settings.time.text), "Âûáðàòü", "Çàêðûòü", 1)
sampSetCurrentDialogEditboxText(settings.time.text)
while sampIsDialogActive(9879) do wait(100) end
local resultMain, buttonMain, typ = sampHasDialogRespond(9879)
if buttonMain == 1 then
if string.len(sampGetCurrentDialogEditboxText(9899)) ~= 0 and string.len(sampGetCurrentDialogEditboxText(9899)) < 99 then
settings.time.text = sampGetCurrentDialogEditboxText(9899)
inicfg.save(settings, 'rphelper.ini')
menuupdate()
menu()
else
menuupdate()
menu()
end
else
menuupdate()
menu()
end
end
},
{
title = ' ',
},
{
title = string.format("{348cb2}Îòûãðîâêà ïðè èñõîäÿùåé ñìñ: {ffffff}%s", settings.smsout.enable),
onclick = function()
if settings.smsout.enable == true then settings.smsout.enable = false else settings.smsout.enable = true end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{FF00AA}%s", settings.smsout.text),
onclick = function()
wait(200)
sampShowDialog(9879, "Óñòàíîâèòü òåêñò îòûãðîâêè.", string.format("Òåêóùèé òåêñò: {FF00AA}"..settings.smsout.text), "Âûáðàòü", "Çàêðûòü", 1)
sampSetCurrentDialogEditboxText(settings.smsout.text)
while sampIsDialogActive(9879) do wait(100) end
local resultMain, buttonMain, typ = sampHasDialogRespond(9879)
if buttonMain == 1 then
if string.len(sampGetCurrentDialogEditboxText(9899)) ~= 0 and string.len(sampGetCurrentDialogEditboxText(9899)) < 99 then
settings.smsout.text = sampGetCurrentDialogEditboxText(9899)
inicfg.save(settings, 'rphelper.ini')
menuupdate()
menu()
else
menuupdate()
menu()
end
else
menuupdate()
menu()
end
end
},
{
title = string.format("{348cb2}Îòûãðîâêà ïðè âõîäÿùåé ñìñ: {ffffff}%s", settings.sms.enable),
onclick = function()
if settings.sms.enable == true then settings.sms.enable = false else settings.sms.enable = true end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{FF00AA}%s", settings.sms.text),
onclick = function()
wait(200)
sampShowDialog(9879, "Óñòàíîâèòü òåêñò îòûãðîâêè.", string.format("Òåêóùèé òåêñò: {FF00AA}"..settings.sms.text), "Âûáðàòü", "Çàêðûòü", 1)
sampSetCurrentDialogEditboxText(settings.sms.text)
while sampIsDialogActive(9879) do wait(100) end
local resultMain, buttonMain, typ = sampHasDialogRespond(9879)
if buttonMain == 1 then
if string.len(sampGetCurrentDialogEditboxText(9899)) ~= 0 and string.len(sampGetCurrentDialogEditboxText(9899)) < 99 then
settings.sms.text = sampGetCurrentDialogEditboxText(9899)
inicfg.save(settings, 'rphelper.ini')
menuupdate()
menu()
else
menuupdate()
menu()
end
else
menuupdate()
menu()
end
end
},
{
title = ' ',
},
{
title = string.format("{348cb2}Îòûãðîâêà ïðè CAR LOCK: {ffffff}%s", settings.carlock.enable),
onclick = function()
if settings.carlock.enable == true then settings.carlock.enable = false else settings.carlock.enable = true end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{FF00AA}%s", settings.carlock.text),
onclick = function()
wait(200)
sampShowDialog(9879, "Óñòàíîâèòü òåêñò îòûãðîâêè.", string.format("Òåêóùèé òåêñò: {FF00AA}"..settings.carlock.text), "Âûáðàòü", "Çàêðûòü", 1)
sampSetCurrentDialogEditboxText(settings.carlock.text)
while sampIsDialogActive(9879) do wait(100) end
local resultMain, buttonMain, typ = sampHasDialogRespond(9879)
if buttonMain == 1 then
if string.len(sampGetCurrentDialogEditboxText(9899)) ~= 0 and string.len(sampGetCurrentDialogEditboxText(9899)) < 99 then
settings.carlock.text = sampGetCurrentDialogEditboxText(9899)
inicfg.save(settings, 'rphelper.ini')
menuupdate()
menu()
else
menuupdate()
menu()
end
else
menuupdate()
menu()
end
end
},
{
title = string.format("{348cb2}Îòûãðîâêà ïðè CAR UNLOCK: {ffffff}%s", settings.carunlock.enable),
onclick = function()
if settings.carunlock.enable == true then settings.carunlock.enable = false else settings.carunlock.enable = true end
menuupdate()
menu()
inicfg.save(settings, 'rphelper.ini')
end
},
{
title = string.format("{FF00AA}%s", settings.carunlock.text),
onclick = function()
wait(200)
sampShowDialog(9879, "Óñòàíîâèòü òåêñò îòûãðîâêè.", string.format("Òåêóùèé òåêñò: {FF00AA}"..settings.carunlock.text), "Âûáðàòü", "Çàêðûòü", 1)
sampSetCurrentDialogEditboxText(settings.carunlock.text)
while sampIsDialogActive(9879) do wait(100) end
local resultMain, buttonMain, typ = sampHasDialogRespond(9879)
if buttonMain == 1 then
if string.len(sampGetCurrentDialogEditboxText(9899)) ~= 0 and string.len(sampGetCurrentDialogEditboxText(9899)) < 99 then
settings.carunlock.text = sampGetCurrentDialogEditboxText(9899)
inicfg.save(settings, 'rphelper.ini')
menuupdate()
menu()
else
menuupdate()
menu()
end
else
menuupdate()
menu()
end
end
},
{
title = ' ',
},
{
title = '{AAAAAA}Ññûëêè'
},
{
title = 'Ïîäïèñûâàéòåñü íà ãðóïïó ÂÊîíòàêòå!',
onclick = function()
local ffi = require 'ffi'
ffi.cdef [[
void* __stdcall ShellExecuteA(void* hwnd, const char* op, const char* file, const char* params, const char* dir, int show_cmd);
uint32_t __stdcall CoInitializeEx(void*, uint32_t);
]]
local shell32 = ffi.load 'Shell32'
local ole32 = ffi.load 'Ole32'
ole32.CoInitializeEx(nil, 2 + 4)
print(shell32.ShellExecuteA(nil, 'open', 'http://vk.com/qrlk.mods', nil, nil, 1))
end
},
-- êîä äèðåêòèâ ffi ñïèçæåí ó FYP'a
{
title = 'Ñâÿçàòüñÿ ñ àâòîðîì (âñå áàãè ñþäà)',
onclick = function()
local ffi = require 'ffi'
ffi.cdef [[
void* __stdcall ShellExecuteA(void* hwnd, const char* op, const char* file, const char* params, const char* dir, int show_cmd);
uint32_t __stdcall CoInitializeEx(void*, uint32_t);
]]
local shell32 = ffi.load 'Shell32'
local ole32 = ffi.load 'Ole32'
ole32.CoInitializeEx(nil, 2 + 4)
print(shell32.ShellExecuteA(nil, 'open', 'http://qrlk.me/sampcontact', nil, nil, 1))
end
},
{
title = 'Îòêðûòü ñòðàíèöó ñêðèïòà',
onclick = function()
local ffi = require 'ffi'
ffi.cdef [[
void* __stdcall ShellExecuteA(void* hwnd, const char* op, const char* file, const char* params, const char* dir, int show_cmd);
uint32_t __stdcall CoInitializeEx(void*, uint32_t);
]]
local shell32 = ffi.load 'Shell32'
local ole32 = ffi.load 'Ole32'
ole32.CoInitializeEx(nil, 2 + 4)
print(shell32.ShellExecuteA(nil, 'open', 'http://qrlk.me/samp/rphelper', nil, nil, 1))
end
},
}
end
--/rphelper menu
function menu()
submenus_show(mod_submenus_sa, '{348cb2}RPHELPER v'..thisScript().version..' by qrlk', 'Âûáðàòü', 'Çàêðûòü', 'Íàçàä')
end
--toggle menu
function scriptmenu()
if Enable == true then
Enable = false
else
menutrigger = 1
end
end
-- submenus_show made by FYP
function submenus_show(menu, caption, select_button, close_button, back_button)
select_button, close_button, back_button = select_button or 'Select', close_button or 'Close', back_button or 'Back'
prev_menus = {}
function display(menu, id, caption)
local string_list = {}
for i, v in ipairs(menu) do
table.insert(string_list, type(v.submenu) == 'table' and v.title .. ' >>' or v.title)
end
sampShowDialog(id, caption, table.concat(string_list, '\n'), select_button, (#prev_menus > 0) and back_button or close_button, 4)
repeat
wait(0)
result, button, list = sampHasDialogRespond(id)
if result then
if button == 1 and list ~= -1 then
local item = menu[list + 1]
if type(item.submenu) == 'table' then -- submenu
table.insert(prev_menus, {menu = menu, caption = caption})
if type(item.onclick) == 'function' then
item.onclick(menu, list + 1, item.submenu)
end
return display(item.submenu, id + 1, item.submenu.title and item.submenu.title or item.title)
elseif type(item.onclick) == 'function' then
local result = item.onclick(menu, list + 1)
if not result then return result end
return display(menu, id, caption)
end
else -- if button == 0
if #prev_menus > 0 then
local prev_menu = prev_menus[#prev_menus]
prev_menus[#prev_menus] = nil
return display(prev_menu.menu, id - 1, prev_menu.caption)
end
return false
end
end
until result
end
return display(menu, 31337, caption or menu.title)
end