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
| local imgui = require("imgui")
local encoding = require ("encoding")
encoding.default = "CP1251"
u8 = encoding.UTF8
local selected_obj = -1
local animation = {
file = imgui.ImBuffer(128),
name = imgui.ImBuffer(128),
time = imgui.ImInt(-1),
lockXY = imgui.ImBool(false),
lockF = imgui.ImBool(false),
loop = imgui.ImBool(false),
speed = imgui.ImFloat(3),
}
local drive = {
speed = imgui.ImFloat(30),
ride_type = imgui.ImInt(0),
drive_type = imgui.ImInt(7),
carid = imgui.ImInt(0)
}
local acterSettings = {
botName = imgui.ImBuffer(24),
textActer = imgui.ImBuffer(128),
skinID = imgui.ImInt(0),
rot = imgui.ImInt(0),
DraweNickName = imgui.ImInt(0),
aimTime = imgui.ImFloat(5),
weap = imgui.ImInt(1),
nickName = imgui.ImBool(false),
}
local objectSettings = {
objIDD = imgui.ImInt(0),
objName = imgui.ImBuffer(24),
rot = imgui.ImInt(0),
pos = {x = 0, y = 0, z = 0}
}
local posititon = {
pos = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0)},
blip = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0)},
mypos = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0)},
object = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0)},
}
local quaternion = {
char = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0), w = imgui.ImFloat(0)},
object = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0), w = imgui.ImFloat(0)}
}
local vcar = {
pos = {x = imgui.ImFloat(0), y = imgui.ImFloat(0), z = imgui.ImFloat(0)},
rotate = 0,
gm = imgui.ImBool(false),
id = imgui.ImInt(411),
color = imgui.ImInt(0),
color2 = imgui.ImInt(0),
handle = {}
}
local handle = 0
local obj = {}
local bots = {}
local selected = -1
local window = imgui.ImBool(false)
font_flag = require("moonloader").font_flag
font = renderCreateFont("Tahoma", 10, font_flag.BOLD + font_flag.BORDER)
local weapons = {
[0] = '##',
[1] = 'Brass Knuckles',
[2] = 'Golf Club',
[3] = 'Nightstick',
[4] = 'Knife',
[5] = 'Baseball Bat ',
[6] = 'Shovel',
[7] = 'Pool Cue',
[8] = 'Katana',
[9] = 'Chainsaw',
[10] = 'Purple Dildo',
[11] = 'Dildo',
[12] = 'Vibrator',
[13] = 'Silver Vibrator',
[14] = 'Flowers',
[15] = 'Cane',
[16] = 'Grenade',
[17] = 'Tear Gas',
[18] = 'Molotov Cocktail',
[19] = '##',
[20] = '##',
[21] = '##',
[22] = 'Pistol',
[23] = 'Silent Pistol',
[24] = 'Desert Eagle',
[25] = 'Shotgun',
[26] = 'Sawnoff Shotgun',
[27] = 'Combat Shotgun',
[28] = 'Micro SMG/Uzi',
[29] = 'MP5',
[30] = 'AK-47',
[31] = 'M4',
[32] = 'Tec-9',
[33] = 'Contry Riffle',
[34] = 'Sniper Riffle',
[35] = 'RPG',
[36] = 'HS Rocket',
[37] = 'Flame Thrower',
[38] = 'Minigun',
[39] = 'Satchel charge',
[40] = 'Detonator',
[41] = 'Spraycan',
[42] = 'Fire Extiguisher',
[43] = 'Camera',
[44] = 'Nigh Vision Goggles',
[45] = 'Thermal Goggles',
[46] = 'Parachute'
}
function main()
while not isSampAvailable() do wait(200) end
animation.name.v = "BIKED_BACK"
animation.file.v = "BIKED"
sampRegisterChatCommand("acter",function()
window.v = not window.v
end)
while true do
wait(0)
if #bots > 0 then
if acterSettings.nickName.v then
for i = 1, #bots do
if bots[i].spawn then
local player_pos = {getCharCoordinates(bots[i].h)}
player_pos[3] = player_pos[3] + 1
local xx,yy = convert3DCoordsToScreen(player_pos[1],player_pos[2],player_pos[3])
if isPointOnScreen(player_pos[1],player_pos[2],player_pos[3]) then
renderFontDrawText(font, bots[i].name, xx, yy, 0xFFFFFFFF)
end
end
end
end
end
imgui.Process = window.v
end
end
function imgui.OnDrawFrame()
if window.v then
local resX, resY = getScreenResolution()
local sizeX, sizeY = 910, 620
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, 310), imgui.Cond.FirstUseEver)
imgui.Begin("Create your own scene", window, imgui.WindowFlags.NoResize)
imgui.BeginChild("bots", imgui.ImVec2(150, 0), true)
if #bots > 0 then
for i = 1, #bots, 1 do
if imgui.Selectable(u8(bots[i].name), selected == i and true or false) then
selected = selected == -1 and i or i == selected and -1 or i or -1
end
end
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild("panel", imgui.ImVec2(550, 0), true)
if selected == -1 then
imgui.PushItemWidth(150)
imgui.InputText(u8"Имя актера", acterSettings.botName)
imgui.PopItemWidth()
if imgui.Button(u8"Создать актера") then
if #acterSettings.botName.v < 3 then
sampAddChatMessage("Имя должно быть от 3 символов", -1)
else
acterSettings.nickName.v = false
table.insert(bots, {spawn = false,h = 0, name = acterSettings.botName.v, pos = {x = 0,y = 0,z = 0}, weap = 0, rot = acterSettings.rot.v,skin = acterSettings.skinID.v })
end
end
else
if select_menu == 1 then
imgui.Text(u8"Имя актера: "..bots[selected].name)
imgui.Text(u8 "задать скина") imgui.SameLine() imgui.PushItemWidth(150) imgui.InputInt(u8'Index', acterSettings.skinID, 1) imgui.PopItemWidth()
imgui.Text(u8 "Задать угол поворота") imgui.SameLine() imgui.PushItemWidth(150) if imgui.SliderInt(u8 "Градус",acterSettings.rot,0,360) then setCharHeading(bots[selected].h,acterSettings.rot.v) end imgui.PopItemWidth()
imgui.Text(u8 "Задать оружие") imgui.SameLine() if imgui.Combo(u8'##weapons', acterSettings.weap, weapons) then giveWeapToActor(bots[selected].h,acterSettings.weap.v) end
if imgui.Button(u8 'Целиться с оружия') then taskAimGunAtChar(bots[selected].h, 1, acterSettings.aimTime.v * 1000) end imgui.SameLine() imgui.PushItemWidth(150) imgui.SliderFloat(u8 'time', acterSettings.aimTime,1,20)imgui.PopItemWidth()
if imgui.CollapsingHeader(u8 'set quaternion') then
if imgui.SliderFloat(u8 'cord X ##8', quaternion.char.x,-1.00000000, 1.00000000) then setCharQuaternion(bots[selected].h, quaternion.char.x.v,quaternion.char.y.v,quaternion.char.z.v,quaternion.char.w.v) end
if imgui.SliderFloat(u8 'cord Y ##9', quaternion.char.y,-1.00000000, 1.00000000) then setCharQuaternion(bots[selected].h, quaternion.char.x.v,quaternion.char.y.v,quaternion.char.z.v,quaternion.char.w.v) end
if imgui.SliderFloat(u8 'cord Z ##10', quaternion.char.z,-1.00000000, 1.00000000) then setCharQuaternion(bots[selected].h, quaternion.char.x.v,quaternion.char.y.v,quaternion.char.z.v,quaternion.char.w.v) end
if imgui.SliderFloat(u8 'cord W ##11', quaternion.char.w,-1.00000000, 1.00000000) then setCharQuaternion(bots[selected].h, quaternion.char.x.v,quaternion.char.y.v,quaternion.char.z.v,quaternion.char.w.v) end
end
imgui.Text(u8 "Задать позицию") imgui.SameLine() imgui.PushItemWidth(100) imgui.InputFloat(u8'##3 POS X', posititon.pos.x, 1) imgui.SameLine() imgui.InputFloat(u8'##3 POS Y', posititon.pos.y, 1) imgui.SameLine() imgui.InputFloat(u8'##3 POS Z', posititon.pos.z, 1) imgui.PopItemWidth()
if imgui.Button("Get my position") then
local x,y,z = getCharCoordinates(1)
posititon.pos.x.v, posititon.pos.y.v, posititon.pos.z.v = tonumber(x), tonumber(y), tonumber(z)
end
imgui.PushItemWidth(100)
imgui.InputText(u8 'текст от лица актера', acterSettings.textActer) imgui.SameLine()
if imgui.Button(u8 "Сказать") then
taskPlayAnim(bots[selected].h, "IDLE_CHAT", "PED", 3.0, false, false, false, true, -1)
lua_thread.create(function()
local x, y, z = getCharCoordinates(bots[selected].h)
text = sampCreate3dText(u8:decode(acterSettings.textActer.v), 0xFFFFFFFF, x, y, z + 1.2,20, false, -1,-1)
wait(10000)
sampDestroy3dText(text)
clearCharTasksImmediately(bots[selected].h)
end)
end
imgui.SameLine()
if imgui.Button(u8 "TP acter") then if bots[selected].h ~= nil and bots[selected].spawn then setCharCoordinates(bots[selected].h, posititon.pos.x.v, posititon.pos.y.v, posititon.pos.z.v) end end
imgui.Checkbox(u8"Рисовать ник бота", acterSettings.nickName)
if imgui.Button(u8 "Spawn", imgui.ImVec2(-1,0)) then
spawnCharFunc(acterSettings.skinID.v)
bots[selected].spawn = true
end
if imgui.Button(u8 "ReSpawn", imgui.ImVec2(-1,0)) then
deleteChar(bots[selected].h)
respawnActor(bots[selected].h)
end
if imgui.Button(u8 "Delete", imgui.ImVec2(-1,0)) then
deleteChar(bots[selected].h)
table.remove(bots, selected)
selected = bots[selected] ~= nil and selected or -1
end
elseif select_menu == 2 then
imgui.Text(u8 "Задать анимацию")
if bots[selected].spawn then
imgui.PushItemWidth(150)
imgui.InputText("name anim",animation.name)
imgui.InputText("file anim",animation.file)
imgui.SliderFloat("speed anim", animation.speed, 0, 10)
imgui.Checkbox("repetition", animation.loop)
if imgui.Button("Play") then
taskPlayAnim(bots[selected].h, animation.name.v, animation.file.v, animation.speed.v, animation.loop.v, false, false, -1)
end
imgui.SameLine()
if imgui.Button("Stop Anim") then
clearCharTasksImmediately(bots[selected].h)
end
imgui.PopItemWidth()
end
end
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild("bots3", imgui.ImVec2(160, 0), true)
if imgui.Button(u8"Настройка бота",imgui.ImVec2(-1, 37)) then
select_menu = 1
end
if imgui.Button(u8"Настройка анимации",imgui.ImVec2(-1, 37)) then
select_menu = 2
end
imgui.EndChild()
imgui.SameLine()
imgui.End()
end
end
function getTargetBlipCoordinatesFixed()
local bool, x, y, z = getTargetBlipCoordinates(); if not bool then return false end
requestCollision(x, y); loadScene(x, y, z)
local bool, x, y, z = getTargetBlipCoordinates()
return bool, x, y, z
end
function join_argb(a, r, g, b)
local argb = b -- b
argb = bit.bor(argb, bit.lshift(g, 8)) -- g
argb = bit.bor(argb, bit.lshift(r, 16)) -- r
argb = bit.bor(argb, bit.lshift(a, 24)) -- a
return argb
end
function imgui.TextQuestion(text)
local war = u8'Подсказка:'
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.PushTextWrapPos(450)
imgui.Text(u8'Подсказка:'..text)
imgui.PopTextWrapPos()
imgui.EndTooltip()
end
end
function spawnCharFunc(modelID)
if bots[selected].h == 0 then
requestModel(modelID)
loadAllModelsNow()
local han = createChar(4, modelID, posititon.pos.x.v, posititon.pos.y.v, posititon.pos.z.v)
bots[selected].h = han
markModelAsNoLongerNeeded(modelID)
else
sampAddChatMessage("Такой актёр уже заспавнен",-1)
end
end
function respawnActor(handle)
if handle ~= 0 then
deleteChar(handle)
requestModel(acterSettings.skinID.v)
loadAllModelsNow()
local han = createChar(4, acterSettings.skinID.v, posititon.pos.x.v, posititon.pos.y.v, posititon.pos.z.v)
bots[selected].h = han
markModelAsNoLongerNeeded(acterSettings.skinID.v)
end
end
function giveWeapToActor(handle, weap)
local model = getWeapontypeModel(weap)
requestModel(model)
loadAllModelsNow()
giveWeaponToChar(handle, weap, 5000)
markModelAsNoLongerNeeded(model)
end
function onScriptTerminate(script, quitGame)
if script == thisScript() then
for i = 1, #bots do
deleteChar(bots[i].h)
end
end
end
function apply_custom_style()
imgui.SwitchContext()
local style = imgui.GetStyle()-- BY IvAn Code-- BY IvAn Code
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
style.WindowPadding = ImVec2(15, 15)
style.WindowRounding = 15.0
style.FramePadding = ImVec2(5, 5)
style.ItemSpacing = ImVec2(12, 8)
style.ItemInnerSpacing = ImVec2(8, 6)
style.IndentSpacing = 25.0
style.ScrollbarSize = 15.0
style.ScrollbarRounding = 15.0
style.GrabMinSize = 15.0
style.GrabRounding = 7.0
style.ChildWindowRounding = 8.0
style.FrameRounding = 6.0
-- BY IvAn Code
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00)
colors[clr.TextDisabled] = ImVec4(0.36, 0.42, 0.47, 1.00)
colors[clr.WindowBg] = ImVec4(0.11, 0.15, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.12, 0.20, 0.28, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00)
colors[clr.TitleBg] = ImVec4(0.09, 0.12, 0.14, 0.65)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.TitleBgActive] = ImVec4(0.08, 0.10, 0.12, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39)
colors[clr.ScrollbarGrab] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.09, 0.21, 0.31, 1.00)
colors[clr.ComboBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.CheckMark] = ImVec4(0.28, 0.56, 1.00, 1.00)-- BY IvAn Code
colors[clr.SliderGrab] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.37, 0.61, 1.00, 1.00)
colors[clr.Button] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.20, 0.25, 0.29, 0.55)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style() |