forked from ztxs/Aimware-v5-luas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AV-Local.lua
433 lines (407 loc) · 17.2 KB
/
AV-Local.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
local function MakeRainbow(speed,gamma)
local r = (math.sin(globals.RealTime() * speed / 10) * 127 + 128) * gamma / 100
local g = (math.sin(globals.RealTime() * speed / 10 + 2) * 127 + 128) * gamma / 100
local b = (math.sin(globals.RealTime() * speed / 10 + 4) * 127 + 128) * gamma / 100
return r,g,b
end
local function lerp(a,b,t) return a * (1-math.abs(t)) + b * math.abs(t) end
local TAB = gui.Reference( "Visuals", "Adv.Viewmodel" )
local IG = gui.Groupbox( TAB, "Local Model Invisible", 30 + (640-45)/2, 790, (640-45)/2, 640 )
local IC = gui.Checkbox( IG, "viewmodel.localinv", "Enable For Local Model", false )
local ICLR = gui.ColorPicker( IC, "viewmodel.localinv.clr", "Local Model Color", 255, 255, 255, 255 )
local IT = gui.Combobox( IG, "viewmodel.localinv.type", "Local Model Material", "Custom","Flat","Chromium","Glow","Crystal" )
local IT_CLR = gui.ColorPicker( IT, "viewmodel.localinv.type.clr", "Special Local Model Color", 255, 255, 255, 255 )
local IA = gui.Checkbox( IG, "viewmodel.localinv.additive", "Additive", false )
local ICOLOR = gui.Combobox( IG, "viewmodel.localinv.colorbase", "Color Modulation Base", "Static","Rainbow","Lerp" )
local ICLR_L_1 = gui.ColorPicker( IG, "viewmodel.localinv.lerp.clr1", "Lerp From", 255, 255, 255, 255 )
local ICLR_L_2 = gui.ColorPicker( IG, "viewmodel.localinv.lerp.clr2", "Lerp To", 255, 255, 255, 255 )
local ISPEED = gui.Slider( IG, "viewmodel.localinv.speed", "Lerp/Rainbow Speed", 10, 1, 100 )
local IRG = gui.Slider( IG, "viewmodel.localinv.rainbow.gamma", "Rainbow Gamma", 100, 1, 100 )
local IPHONG = gui.Slider( IG, "viewmodel.localinv.phong", "Phong", 0, 0, 100 )
local IPEARL = gui.Slider( IG, "viewmodel.localinv.pearl","Pearlescent", 0, 0, 100 )
local IREFLECTIVITY = gui.Slider(IG,"viewmodel.localinv.reflectivity","Reflectivity",0,0,100)
local IGLOW = gui.Slider( IG, "viewmodel.localinv.glowint", "Glow Int", 2, 2, 50 )
local io_w = nil
local io_g = nil
local ig_old_r,ig_old_g,ig_old_b,ig_old_a = 255
local ig_old_glow = 2
local iold_r,iold_g,iold_b,old_a = 255
local iold_phong, iold_pearl, iold_reflectivity, iold_glow = 0
local imat = nil
local iold_type = 0
local function IOnDraw()
local r,g,b,a = IT_CLR:GetValue()
local type = IT:GetValue()
local pearl = IPEARL:GetValue() / 100 * 10
local phong = IPHONG:GetValue() / 100 * 20
local reflectivity = IREFLECTIVITY:GetValue()/100
local glow = IGLOW:GetValue()
if iold_type ~= type or imat == nil or iold_r ~= r or iold_g ~= g or iold_b ~= b or iold_a ~= a or iold_pearl ~= pearl or iold_phong ~= phong or iold_reflectivity ~= reflectivity or iold_glow ~= glow then
if type == 0 then
imat = materials.Create("aw_vm_localinv",
[[
VertexLitGeneric
{
$basetexture vgui/white_additive
$envmap env_cubemap
$envmaptint "[]] .. r/255 * reflectivity .. " " .. g/255 * reflectivity .. " " .. b/255 * reflectivity .. [[]"
$phong 1
$phongboost ]] .. phong .. [[
$basemapalphaphongmask 1
$pearlescent ]] .. pearl.. [[
$ignorez 1
$nocull 1
}
]])
elseif type == 1 then
imat = materials.Create("aw_vm_localinv",
[[
UnlitGeneric
{
$model 1
$ignorez 1
}
]])
elseif type == 2 then
imat = materials.Create("aw_vm_localinv",
[[
VertexLitGeneric
{
$basetexture vgui/white_additve
$envmap env_cubemap
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 .. [[]"
$ignorez 1
}
]])
elseif type == 3 then
imat = materials.Create("aw_vm_localinv",
[[
VertexLitGeneric
{
$basetexture vgui/white_additive
$envmap models/effects/cube_white
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 .. [[]"
$envmapfresnel 1
$envmapfresnelminmaxexp "[0 1 ]] .. glow .. [[]"
$ignorez 1
}
]])
elseif type == 4 then
imat = materials.Create( "aw_vm_localinv",
[[
VertexLitGeneric
{
$baseTexture black
$bumpmap effects\flat_normal
$translucent 1
$alpha 0.4
$envmap models\effects\crystal_cube_vertigo_hdr
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 ..[[]"
//$envmaptint "[0.8 1.2 1.5]"
//$envmapcontrast 1.2
$envmapsaturation 0.1
$envmapfresnel 0
$phong 1
$phongexponent 16
$phongtint "[]].. r/255 .. " " .. g/255 .. " " .. b/255 ..[[]"
$phongboost 2
//$nocull 1
$ignorez 1
}
]])
end
end
iold_r,iold_g,iold_b,iold_a = IT_CLR:GetValue()
iold_type = type
iold_pearl = pearl
iold_phong = phong
iold_reflectivity = reflectivity
iold_glow = glow
end
local function IModel(Context)
if Context:GetEntity() ~= nil and IC:GetValue() then
gui.SetValue( "esp.chams.local.occluded", 0 )
if Context:GetEntity():GetIndex() == entities.GetLocalPlayer():GetIndex() then
local r,g,b,a = ICLR:GetValue()
if ICOLOR:GetValue() == 0 then
imat:ColorModulate(r/255,g/255,b/255)
elseif ICOLOR:GetValue() == 1 then
r,g,b = MakeRainbow(ISPEED:GetValue(),IRG:GetValue())
imat:ColorModulate(r/255,g/255,b/255)
elseif ICOLOR:GetValue() == 2 then
local r1,g1,b1,a1 = ICLR_L_1:GetValue()
local r2,g2,b2,a2 = ICLR_L_2:GetValue()
r = lerp(r1,r2,math.sin(globals.RealTime() * ISPEED:GetValue() / 10))
g = lerp(g1,g2,math.sin(globals.RealTime() * ISPEED:GetValue() / 10))
b = lerp(b1,b2,math.sin(globals.RealTime() * ISPEED:GetValue() / 10))
mat:ColorModulate(r/255,g/255,b/255)
end
imat:AlphaModulate(a/255)
imat:SetMaterialVarFlag(128,IA:GetValue())
Context:ForcedMaterialOverride(imat)
Context:DrawExtraPass()
end
end
end
local function IGUIWork()
if ICOLOR:GetValue() == 0 then
ICLR_L_1:SetDisabled(true)
ICLR_L_2:SetDisabled(true)
ISPEED:SetDisabled(true)
IRG:SetDisabled(true)
elseif ICOLOR:GetValue() == 1 then
ICLR_L_1:SetDisabled(true)
ICLR_L_2:SetDisabled(true)
ISPEED:SetDisabled(false)
IRG:SetDisabled(false)
elseif ICOLOR:GetValue() == 2 then
ICLR_L_1:SetDisabled(false)
ICLR_L_2:SetDisabled(false)
ISPEED:SetDisabled(false)
IRG:SetDisabled(true)
end
if IT:GetValue() == 0 then
IPHONG:SetDisabled(false)
IREFLECTIVITY:SetDisabled(false)
IPEARL:SetDisabled(false)
else
IPHONG:SetDisabled(true)
IREFLECTIVITY:SetDisabled(true)
IPEARL:SetDisabled(true)
end
if IT:GetValue() == 3 then
IGLOW:SetDisabled(false)
else
IGLOW:SetDisabled(true)
end
end
callbacks.Register( "Draw", IGUIWork )
callbacks.Register( "Draw", IOnDraw )
callbacks.Register( "DrawModel", IModel)
local G = gui.Groupbox( TAB, "Local Model Visible", 15, 790, (640-45)/2, 640 )
local C = gui.Checkbox( G, "viewmodel.local", "Enable For Local Model", false )
local CLR = gui.ColorPicker( C, "viewmodel.local.clr", "Local Model Color", 255, 255, 255, 255 )
local T = gui.Combobox( G, "viewmodel.local.type", "Local Model Material", "Custom","Flat","Chromium","Glow","Crystal" )
local T_CLR = gui.ColorPicker( T, "viewmodel.local.type.clr", "Special Local Model Color", 255, 255, 255, 255 )
local A = gui.Checkbox( G, "viewmodel.local.additive", "Additive", false )
local COLOR = gui.Combobox( G, "viewmodel.local.colorbase", "Color Modulation Base", "Static","Rainbow","Lerp" )
local CLR_L_1 = gui.ColorPicker( G, "viewmodel.local.lerp.clr1", "Lerp From", 255, 255, 255, 255 )
local CLR_L_2 = gui.ColorPicker( G, "viewmodel.local.lerp.clr2", "Lerp To", 255, 255, 255, 255 )
local SPEED = gui.Slider( G, "viewmodel.local.speed", "Lerp/Rainbow Speed", 10, 1, 100 )
local RG = gui.Slider( G, "viewmodel.local.rainbow.gamma", "Rainbow Gamma", 100, 1, 100 )
local PHONG = gui.Slider( G, "viewmodel.local.phong", "Phong", 0, 0, 100 )
local PEARL = gui.Slider( G, "viewmodel.local.pearl","Pearlescent", 0, 0, 100 )
local REFLECTIVITY = gui.Slider(G,"viewmodel.local.reflectivity","Reflectivity",0,0,100)
local GLOW = gui.Slider( G, "viewmodel.local.glowint", "Glow Int", 2, 2, 50 )
local O = gui.Multibox( G, "Overlay" )
local O_WIRE = gui.Checkbox( O, "viewmodel.local.overlay.wire", "Wire", false )
local O_GLOW = gui.Checkbox( O, "viewmodel.local.overlay.glow", "Glow", false)
local O_WIRE_CLR = gui.ColorPicker( G, "viewmodel.local.overlay.wire.clr", "Wire Overlay Color", 255, 255, 255, 255 )
local O_GLOW_CLR = gui.ColorPicker( G, "viewmodel.local.overlay.glow.clr", "Glow Overlay Color", 255, 255, 255, 255 )
local O_GLOW_INT = gui.Slider( G, "viewmodel.local.overlay.glow.int", "Glow Overlay Int", 2, 2, 50 )
local o_w = nil
local o_g = nil
local g_old_r,g_old_g,g_old_b,g_old_a = 255
local g_old_glow = 2
local old_r,old_g,old_b,old_a = 255
local old_phong, old_pearl, old_reflectivity, old_glow = 0
local mat = nil
local old_type = 0
local function OnDraw()
local r,g,b,a = T_CLR:GetValue()
local type = T:GetValue()
local pearl = PEARL:GetValue() / 100 * 10
local phong = PHONG:GetValue() / 100 * 20
local reflectivity = REFLECTIVITY:GetValue()/100
local glow = GLOW:GetValue()
if old_type ~= type or mat == nil or old_r ~= r or old_g ~= g or old_b ~= b or old_a ~= a or old_pearl ~= pearl or old_phong ~= phong or old_reflectivity ~= reflectivity or old_glow ~= glow then
if type == 0 then
mat = materials.Create("aw_vm_local",
[[
VertexLitGeneric
{
$basetexture vgui/white_additive
$envmap env_cubemap
$envmaptint "[]] .. r/255 * reflectivity .. " " .. g/255 * reflectivity .. " " .. b/255 * reflectivity .. [[]"
$phong 1
$phongboost ]] .. phong .. [[
$basemapalphaphongmask 1
$pearlescent ]] .. pearl.. [[
}
]])
elseif type == 1 then
mat = materials.Create("aw_vm_local",
[[
UnlitGeneric
{
$model 1
}
]])
elseif type == 2 then
mat = materials.Create("aw_vm_local",
[[
VertexLitGeneric
{
$basetexture vgui/white_additve
$envmap env_cubemap
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 .. [[]"
}
]])
elseif type == 3 then
mat = materials.Create("aw_vm_local",
[[
VertexLitGeneric
{
$basetexture vgui/white_additive
$envmap models/effects/cube_white
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 .. [[]"
$envmapfresnel 1
$envmapfresnelminmaxexp "[0 1 ]] .. glow .. [[]"
}
]])
elseif type == 4 then
mat = materials.Create( "aw_vm_local",
[[
VertexLitGeneric
{
$baseTexture black
$bumpmap effects\flat_normal
$translucent 1
$alpha 0.4
$envmap models\effects\crystal_cube_vertigo_hdr
$envmaptint "[]] .. r/255 .. " " .. g/255 .. " " .. b/255 ..[[]"
//$envmaptint "[0.8 1.2 1.5]"
//$envmapcontrast 1.2
$envmapsaturation 0.1
$envmapfresnel 0
$phong 1
$phongexponent 16
$phongtint "[]].. r/255 .. " " .. g/255 .. " " .. b/255 ..[[]"
$phongboost 2
//$nocull 1
}
]])
end
end
old_r,old_g,old_b,old_a = T_CLR:GetValue()
old_type = type
old_pearl = pearl
old_phong = phong
old_reflectivity = reflectivity
old_glow = glow
end
local function Overlay()
local wr,wg,wb,wa = O_WIRE_CLR:GetValue()
local gr,gg,gb,ga = O_GLOW_CLR:GetValue()
local glow = O_GLOW_INT:GetValue()
if o_w == nil then
o_w = materials.Create("aw_vm_local_wire",
[[
VertexLitGeneric
{
$basetexture vgui/white_additive
}
]])
end
if o_g == nil or g_old_r ~= gr or g_old_g ~= gg or g_old_b ~= gb or g_old_glow ~= glow then
o_g = materials.Create("aw_vm_local_glow",
[[
VertexLitGeneric
{
$additive 1
$envmap models/effects/cube_white
$envmaptint "[]].. gr/255 .. " " .. gg/255 .. " " .. gb/255 .. [[]"
$envmapfresnel 1
$envmapfresnelminmaxexp "[0 1 ]].. glow .. [[]"
}
]])
end
g_old_r,g_old_g,g_old_b,g_old_a = O_GLOW_CLR:GetValue()
g_old_glow = O_GLOW_INT:GetValue()
end
local function Model(Context)
if Context:GetEntity() ~= nil and C:GetValue() then
gui.SetValue( "esp.chams.local.visible", 0 )
if Context:GetEntity():GetIndex() == entities.GetLocalPlayer():GetIndex() then
local r,g,b,a = CLR:GetValue()
if COLOR:GetValue() == 0 then
mat:ColorModulate(r/255,g/255,b/255)
elseif COLOR:GetValue() == 1 then
r,g,b = MakeRainbow(SPEED:GetValue(),RG:GetValue())
mat:ColorModulate(r/255,g/255,b/255)
elseif COLOR:GetValue() == 2 then
local r1,g1,b1,a1 = CLR_L_1:GetValue()
local r2,g2,b2,a2 = CLR_L_2:GetValue()
r = lerp(r1,r2,math.sin(globals.RealTime() * SPEED:GetValue() / 10))
g = lerp(g1,g2,math.sin(globals.RealTime() * SPEED:GetValue() / 10))
b = lerp(b1,b2,math.sin(globals.RealTime() * SPEED:GetValue() / 10))
mat:ColorModulate(r/255,g/255,b/255)
end
mat:AlphaModulate(a/255)
mat:SetMaterialVarFlag(128,A:GetValue())
Context:ForcedMaterialOverride(mat)
if O_WIRE:GetValue() then
local r,g,b,a = O_WIRE_CLR:GetValue()
Context:DrawExtraPass()
o_w:AlphaModulate(a/255)
o_w:ColorModulate(r/255,g/255,b/255)
o_w:SetMaterialVarFlag(268435456,1)
Context:ForcedMaterialOverride(o_w)
end
if O_GLOW:GetValue() then
local r,g,b,a = O_GLOW_CLR:GetValue()
Context:DrawExtraPass()
o_g:AlphaModulate(a/255)
Context:ForcedMaterialOverride(o_g)
end
end
end
end
local function GUIWork()
if COLOR:GetValue() == 0 then
CLR_L_1:SetDisabled(true)
CLR_L_2:SetDisabled(true)
SPEED:SetDisabled(true)
RG:SetDisabled(true)
elseif COLOR:GetValue() == 1 then
CLR_L_1:SetDisabled(true)
CLR_L_2:SetDisabled(true)
SPEED:SetDisabled(false)
RG:SetDisabled(false)
elseif COLOR:GetValue() == 2 then
CLR_L_1:SetDisabled(false)
CLR_L_2:SetDisabled(false)
SPEED:SetDisabled(false)
RG:SetDisabled(true)
end
if T:GetValue() == 0 then
PHONG:SetDisabled(false)
REFLECTIVITY:SetDisabled(false)
PEARL:SetDisabled(false)
else
PHONG:SetDisabled(true)
REFLECTIVITY:SetDisabled(true)
PEARL:SetDisabled(true)
end
if T:GetValue() == 3 then
GLOW:SetDisabled(false)
else
GLOW:SetDisabled(true)
end
if O_GLOW:GetValue() then
O_GLOW_INT:SetDisabled(false)
O_GLOW_CLR:SetDisabled(false)
else
O_GLOW_INT:SetDisabled(true)
O_GLOW_CLR:SetDisabled(true)
end
if O_WIRE:GetValue() then
O_WIRE_CLR:SetDisabled(false)
else
O_WIRE_CLR:SetDisabled(true)
end
end
callbacks.Register( "Draw", GUIWork )
callbacks.Register( "Draw", OnDraw )
callbacks.Register( "DrawModel", Model)
callbacks.Register( "Draw", Overlay )