This repository has been archived by the owner on Oct 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
afkparty.js
335 lines (270 loc) · 9.37 KB
/
afkparty.js
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
// https://github.com/sotakoira/otcv3-scripts
UI.AddDropdown("Autobuy weapon", ["none", "AK-47/M4A4", "SG553/AUG", "Galil AR/FAMAS", "SSG08", "AWP", "G3SG1/SCAR20", "MAC10/MP9", "PP-Bizon", "P90", "M249", "Negev", "XM1014"]);
UI.AddCheckbox("Autodrop weapon");
UI.AddCheckbox("Autodrop bomb");
UI.AddCheckbox("AntiAFK");
UI.AddCheckbox("Call surrender");
UI.AddCheckbox("Call timeout");
UI.AddCheckbox("Kick on teamkill");
UI.AddCheckbox("Sound on team damage");
UI.AddCheckbox("Loopback");
UI.AddLabel("Relative to csgo/sound/");
UI.AddTextbox("File name");
UI.AddSliderFloat("Sound length", 0.0, 10.0);
UI.AddCheckbox("Reduce rate and FPS");
UI.AddCheckbox("Radio spammer");
var weapons_buying = [
"ak47",
"sg556",
"galilar",
"ssg08",
"awp",
"g3sg1",
"mp9",
"bizon",
"p90",
"m249",
"negev",
"xm1014",
];
var radio_colors = [
"\u0001", //white
"\u0002", //darkred
"\u0004", //green
"\u0005", //lightgreen
"\u0006", //lime
"\u0007", //palered
"\u0008", //grey
"\u000E", //orchid
"\u000F", //lightred
"\u0010", //gold
"", //empty
];
var rclength = radio_colors.length;
var forward = 0;
var side = 0;
var rate_cache = Convar.GetFloat("rate");
var fps_cache = Convar.GetFloat("fps_max");
var shouldchange = false;
var v_curtime = 0;
var rs_curtime = 0;
var in_attack2 = false;
function generate_cmd() {
afk_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "AntiAFK");
if (afk_active) {
forward = Math.ceil(Math.random() * 450) * (Math.round(Math.random()) ? 1 : -1);
side = Math.ceil(Math.random() * 450) * (Math.round(Math.random()) ? 1 : -1);
}
}
function call_surrender() {
cs_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Call surrender");
if (cs_active) {
players = Entity.GetTeammates().length;
if (players < 5) {Cheat.ExecuteCommand("callvote surrender"); }
}
}
function call_timeout() {
to_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Call timeout");
if (to_active) {
local = Entity.GetLocalPlayer();
team = Entity.GetProp(local, "DT_BaseEntity", "m_iTeamNum");
gamerules = Entity.GetGameRulesProxy();
t_to = Entity.GetProp(gamerules, "CCSGameRulesProxy", "m_nTerroristTimeOuts");
ct_to = Entity.GetProp(gamerules, "CCSGameRulesProxy", "m_nCTTimeOuts");
if (team == 2) { timeouts = t_to; }
else if (team == 3) { timeouts = ct_to; }
else return;
if (timeouts > 0) {Cheat.ExecuteCommand("callvote starttimeout"); }
}
}
function autodrop_bomb() {
ab_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Autodrop bomb");
userid = Event.GetInt("userid");
userid_index = Entity.GetEntityFromUserID(userid);
is_localplayer = Entity.IsLocalPlayer(userid_index);
if (ab_active && is_localplayer) {
Cheat.ExecuteCommand("use weapon_c4");
Cheat.ExecuteCommand("drop");
}
}
function autobuy_weapon() {
abw = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Autobuy weapon");
adw_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Autodrop weapon");
local = Entity.GetLocalPlayer();
in_buyzone = Entity.GetProp(local, "DT_CSPlayer", "m_bInBuyZone");
if (in_buyzone && abw != 0) {
Cheat.ExecuteCommand("buy " + weapons_buying[abw - 1]);
}
}
function autodrop_weapon() {
adw_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Autodrop weapon");
if (adw_active) {
userid = Event.GetInt("userid");
item = Event.GetString("item");
userid_index = Entity.GetEntityFromUserID(userid);
userid_localplayer = Entity.IsLocalPlayer(userid_index);
if (userid_localplayer && item != "c4") {
Cheat.ExecuteCommand("drop");
}
}
}
function autoequip_weapon() {
adw_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Autodrop weapon");
if (adw_active) {
userid = Event.GetInt("userid");
item = Event.GetString("item");
userid_index = Entity.GetEntityFromUserID(userid);
userid_localplayer = Entity.IsLocalPlayer(userid_index);
if (userid_localplayer && item != "c4") {
Cheat.ExecuteCommand("slot2");
Cheat.ExecuteCommand("slot1");
}
}
}
function kick_on_tk() {
tkk_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Kick on teamkill");
if (tkk_active) {
attacker = Event.GetInt("attacker");
userid = Event.GetInt("userid");
attacker_index = Entity.GetEntityFromUserID(attacker);
userid_index = Entity.GetEntityFromUserID(userid);
userid_localplayer = Entity.IsLocalPlayer(userid_index);
attacker_isteammate = Entity.IsTeammate(attacker_index);
if (attacker_isteammate && userid_localplayer) {
Cheat.ExecuteCommand("callvote kick " + attacker);
}
}
}
function antiafk() {
afk_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "AntiAFK");
local = Entity.GetLocalPlayer();
gamerules = Entity.GetGameRulesProxy();
hasmoved = Entity.GetProp(local, "DT_CSPlayer", "m_bHasMovedSinceSpawn");
in_freeze = Entity.GetProp(gamerules, "CCSGameRulesProxy", "m_bFreezePeriod");
t_timeout = Entity.GetProp(gamerules, "CCSGameRulesProxy", "m_bTerroristTimeOutActive");
ct_timeout = Entity.GetProp(gamerules, "CCSGameRulesProxy", "m_bCTTimeOutActive");
if (afk_active) {
if (!hasmoved) { UserCMD.SetMovement( [ forward, side, 0 ] ); }
if ((t_timeout || ct_timeout) && in_freeze) {
Cheat.ExecuteCommand("+attack2");
in_attack2 = true;
}
if (!(t_timeout || ct_timeout) && in_attack2) {
Cheat.ExecuteCommand("-attack2");
in_attack2 = false;
}
}
}
function reduceusage() {
if (UI.IsMenuOpen()) {
reduce_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Reduce rate and FPS");
if (reduce_active && !shouldchange) {
Convar.SetFloat("rate", 20480);
Convar.SetFloat("fps_max", 49);
shouldchange = true;
}
else if (!reduce_active && shouldchange) {
Convar.SetFloat("rate", rate_cache);
Convar.SetFloat("fps_max", fps_cache);
shouldchange = false;
}
}
}
function vischeck() {
if (UI.IsMenuOpen()) {
sotd_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Sound on team damage");
if (sotd_active) {
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Loopback", true)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Sound length", true)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Relative to csgo/sound/", true)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "File name", true)
} else {
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Loopback", false)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Sound length", false)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "Relative to csgo/sound/", false)
UI.SetEnabled("Misc", "JAVASCRIPT", "Script Items", "File name", false)
}
}
}
function sound_on_td() {
sot_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Sound on team damage");
if (sot_active) {
userid = Event.GetInt("userid");
attacker = Event.GetInt("attacker");
attacker_index = Entity.GetEntityFromUserID(attacker);
userid_index = Entity.GetEntityFromUserID(userid);
attacker_name = Entity.GetName(attacker_index);
userid_name = Entity.GetName(userid_index);
attacker_teammate = Entity.IsTeammate(attacker_index);
userid_teammate = Entity.IsTeammate(userid_index);
isuseridlocal = Entity.IsLocalPlayer(userid_index);
if (attacker_teammate && userid_teammate) {
if ((isuseridlocal && attacker_teammate) && (userid != attacker)) {
loopback = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Loopback");
if (loopback) {Cheat.ExecuteCommand("voice_loopback 1");}
filename = UI.GetString("Misc", "JAVASCRIPT", "Script Items", "File name");
Sound.PlayMicrophone("csgo//sound//" + filename + ".wav");
v_curtime = Global.Curtime();
}
}
}
}
function soundcheck() {
if (Cheat.FrameStage() != 1) {return;}
sot_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Sound on team damage");
if (sot_active) {
s_length = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Sound length");
if (Global.Curtime() > v_curtime + s_length) {
if (loopback) {Cheat.ExecuteCommand("voice_loopback 0");}
Sound.StopMicrophone();
}
}
}
function radiospammer() {
if (Cheat.FrameStage() != 1) {return;}
rs_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Radio spammer");
if (rs_active) {
if (Global.Curtime() > rs_curtime + 10.2) {
for (i =1; i <= 3; i++) {
Cheat.ExecuteCommand("playerchatwheel . " + radio_colors[Math.floor(Math.random() * rclength)] + "afkparty.js");
}
rs_curtime = Global.Curtime();
}
}
}
function reset() {
localplayer = Entity.GetLocalPlayer();
userid = Event.GetInt("userid");
if (Entity.GetEntityFromUserID(userid) == localplayer) {
v_curtime = 0;
rs_curtime = 0;
}
}
function unload() {
reduce_active = UI.GetValue("Misc", "JAVASCRIPT", "Script Items", "Reduce rate and FPS");
if (reduce_active) {
Convar.SetFloat("rate", rate_cache);
Convar.SetFloat("fps_max", fps_cache);
shouldchange = false;
}
if (in_attack2) {
Cheat.ExecuteCommand("-attack2");
in_attack2 = false;
}
}
Cheat.RegisterCallback("round_start", "generate_cmd");
Cheat.RegisterCallback("round_start", "call_surrender");
Cheat.RegisterCallback("round_freeze_end", "autobuy_weapon");
Cheat.RegisterCallback("round_freeze_end", "call_timeout");
Cheat.RegisterCallback("item_pickup", "autoequip_weapon");
Cheat.RegisterCallback("item_equip", "autodrop_weapon");
Cheat.RegisterCallback("bomb_pickup", "autodrop_bomb");
Cheat.RegisterCallback("player_death", "kick_on_tk");
Cheat.RegisterCallback("player_hurt", "sound_on_td");
Cheat.RegisterCallback("player_connect_full", "reset");
Cheat.RegisterCallback("CreateMove", "antiafk");
Cheat.RegisterCallback("Draw", "reduceusage");
Cheat.RegisterCallback("Draw", "vischeck");
Cheat.RegisterCallback("FrameStageNotify", "radiospammer");
Cheat.RegisterCallback("FrameStageNotify", "soundcheck");
Cheat.RegisterCallback("Unload", "unload");