Skip to content
This repository was archived by the owner on Dec 22, 2025. It is now read-only.

Commit f96866a

Browse files
committed
Fixed semi-colon in args exploit and added bot weapon pool commands
1 parent 872ac9c commit f96866a

2 files changed

Lines changed: 99 additions & 20 deletions

File tree

PracPlugin/PracPlugin.cs

Lines changed: 91 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,29 @@ public override void Load(bool hotReload)
2323
{
2424
AddCommand("bots", "adds friends", (player, info) =>
2525
{
26-
int bots = 5;
27-
if (info.ArgByIndex(1) != null)
26+
try
2827
{
29-
bots = int.Parse(info.ArgByIndex(1));
30-
}
31-
Server.ExecuteCommand("mp_limitteams 2");
32-
Server.ExecuteCommand("mp_autoteambalance 1");
33-
Server.ExecuteCommand("bot_quota_mode fill");
34-
Server.ExecuteCommand("bot_quota 10");
35-
for (int i = 0; i < bots; i++)
28+
int bots = 5;
29+
if (info.ArgByIndex(1) != null)
30+
{
31+
bots = int.Parse(info.ArgByIndex(1));
32+
}
33+
34+
Server.ExecuteCommand("mp_limitteams 2");
35+
Server.ExecuteCommand("mp_autoteambalance 1");
36+
Server.ExecuteCommand("bot_quota_mode fill");
37+
Server.ExecuteCommand("bot_quota 10");
38+
for (int i = 0; i < bots; i++)
39+
{
40+
Server.ExecuteCommand("bot_add");
41+
}
42+
info.ReplyToCommand("Added bots");
43+
} catch(Exception)
3644
{
37-
Server.ExecuteCommand("bot_add");
45+
info.ReplyToCommand("Invalid argument");
46+
return;
3847
}
39-
info.ReplyToCommand("Added bots");
48+
4049
});
4150
AddCommand("removebots", "removes friends", (player, info) =>
4251
{
@@ -46,6 +55,11 @@ public override void Load(bool hotReload)
4655
AddCommand("botdifficulty", "", (player, info) =>
4756
{
4857
var arg = info.ArgByIndex(1);
58+
if(int.TryParse(arg, out int result) == false)
59+
{
60+
info.ReplyToCommand("Invalid argument");
61+
return;
62+
}
4963
Server.ExecuteCommand($"bot_difficulty {arg}"); // 0 = easy, 1 = normal, 2 = hard, 3 = expert
5064
info.ReplyToCommand($"Set bot difficulty to {arg}");
5165
});
@@ -58,10 +72,11 @@ public override void Load(bool hotReload)
5872
});
5973
AddCommand("onlybotsct", "", (player, info) =>
6074
{
61-
int bots = 5;
62-
if (info.ArgByIndex(1) != null)
75+
var arg = info.ArgByIndex(1);
76+
if (int.TryParse(arg, out int bots) == false)
6377
{
64-
bots = int.Parse(info.ArgByIndex(1));
78+
info.ReplyToCommand("Invalid argument");
79+
return;
6580
}
6681
Server.ExecuteCommand("mp_limitteams 0");
6782
Server.ExecuteCommand("mp_autoteambalance 0");
@@ -74,10 +89,11 @@ public override void Load(bool hotReload)
7489
});
7590
AddCommand("onlybotst", "", (player, info) =>
7691
{
77-
int bots = 5;
78-
if(info.ArgByIndex(1) != null)
92+
var arg = info.ArgByIndex(1);
93+
if (int.TryParse(arg, out int bots) == false)
7994
{
80-
bots = int.Parse(info.ArgByIndex(1));
95+
info.ReplyToCommand("Invalid argument");
96+
return;
8197
}
8298
Server.ExecuteCommand("mp_limitteams 0");
8399
Server.ExecuteCommand("mp_autoteambalance 0");
@@ -101,16 +117,26 @@ public override void Load(bool hotReload)
101117
AddCommand("maxrounds", "", (player, info) =>
102118
{
103119
var arg = info.ArgByIndex(1);
120+
if (int.TryParse(arg, out int bots) == false)
121+
{
122+
info.ReplyToCommand("Invalid argument");
123+
return;
124+
}
104125
Server.ExecuteCommand($"mp_maxrounds {arg}");
105126
info.ReplyToCommand($"Set max rounds to {arg}");
106-
});
127+
});
107128
AddCommand("prachelp", "", (player, info) =>
108129
{
109-
info.ReplyToCommand("Commands: bots <bots_amount>, removebots, botdifficulty <bots_diff>, skipwarmup , onlybotsct <bots_amount>, onlybotst <bots_amount>, disablebans, enablebans, maxrounds <rounds>, changemap <map_name>, swapteams, casual, deathmatch, competetive, wingman ");
130+
info.ReplyToCommand("Commands: bots <bots_amount>, removebots, botdifficulty <bots_diff>, skipwarmup, onlybotsct <bots_amount>, onlybotst <bots_amount>, disablebans, enablebans, maxrounds <rounds>, changemap <map_name>, swapteams, casual, deathmatch, competetive, wingman, botdisableweapons, botenableweapons, botknifes, botsnipers, botpistol, botsmg, botrifles");
110131
});
111132
AddCommand("changemap", "", (player, info) =>
112133
{
113134
var arg = info.ArgByIndex(1);
135+
if (int.TryParse(arg, out int bots) == false)
136+
{
137+
info.ReplyToCommand("Invalid argument");
138+
return;
139+
}
114140
Server.ExecuteCommand($"changelevel {arg}");
115141
});
116142
AddCommand("swapteams", "", (player, info) =>
@@ -149,7 +175,52 @@ public override void Load(bool hotReload)
149175
var currentmap = Server.MapName;
150176
Server.ExecuteCommand($"changelevel {currentmap}");
151177
});
152-
178+
AddCommand("botdisableweapons", "", (player, info) =>
179+
{
180+
Server.ExecuteCommand("bot_allow_grenades 0");
181+
Server.ExecuteCommand("bot_allow_pistols 0");
182+
Server.ExecuteCommand("bot_allow_sub_machine_guns 0");
183+
Server.ExecuteCommand("bot_allow_shotguns 0");
184+
Server.ExecuteCommand("bot_allow_rifles 0");
185+
Server.ExecuteCommand("bot_allow_snipers 0");
186+
Server.ExecuteCommand("bot_allow_machine_guns 0");
187+
Server.ExecuteCommand("bot_allow_knives 0");
188+
});
189+
AddCommand("botenableweapons", "", (player, info) =>
190+
{
191+
192+
// could use bot_all_weapons
193+
Server.ExecuteCommand("bot_allow_grenades 1");
194+
Server.ExecuteCommand("bot_allow_pistols 1");
195+
Server.ExecuteCommand("bot_allow_sub_machine_guns 1");
196+
Server.ExecuteCommand("bot_allow_shotguns 1");
197+
Server.ExecuteCommand("bot_allow_rifles 1");
198+
Server.ExecuteCommand("bot_allow_snipers 1");
199+
Server.ExecuteCommand("bot_allow_machine_guns 1");
200+
Server.ExecuteCommand("bot_allow_knives 1");
201+
});
202+
203+
AddCommand("botknifes", "", (player, info) =>
204+
{
205+
Server.ExecuteCommand("bot_knives_only 1");
206+
});
207+
AddCommand("botsnipers", "", (player, info) =>
208+
{
209+
Server.ExecuteCommand("bot_allow_snipers 1");
210+
});
211+
AddCommand("botpistol", "", (player, info) =>
212+
{
213+
Server.ExecuteCommand("bot_allow_pistols 1");
214+
});
215+
AddCommand("botsmg", "", (player, info) =>
216+
{
217+
Server.ExecuteCommand("bot_allow_sub_machine_guns 1");
218+
});
219+
AddCommand("botrifles", "", (player, info) =>
220+
{
221+
Server.ExecuteCommand("bot_allow_rifles 1");
222+
});
223+
153224
base.Load(hotReload);
154225
}
155226

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
- deathmatch - same as above but with dm
1818
- competetive - same as above but with comp
1919
- wingman - same as above but with wingman
20+
- botdisableweapons - disables all weapons for bots
21+
- botenableweapons - enables all weapons for bots
22+
- botknifes - toggles knife for bots weapon pool
23+
- botsnipers - toggles snipers for bots weapon pool
24+
- botshotguns - toggles shotguns for bots weapon pool
25+
- botpistol - toggles pistols for bots weapon pool
26+
- botsmg - toggles smgs for bots weapon pool
27+
- botrifles - toggles rifles for bots weapon pool
2028

2129
## Currently Implemented
2230
- Settings bots difficulty

0 commit comments

Comments
 (0)