Skip to content

Commit f6c6ab0

Browse files
author
Chanz
committed
Version 1.6 - Added 2 new commands + fixes
Added sm_scrambleteam, shuffles all clients into different teams. Added sm_swapteam, swaps all clients to the other team. Fixed sm_score, sm_deaths and sm_money to target dead players too. Removed sm_balanceteams. since its just an alias to sm_balanceteam.
1 parent ed84aa4 commit f6c6ab0

File tree

2 files changed

+51
-31
lines changed

2 files changed

+51
-31
lines changed
426 Bytes
Binary file not shown.

addons/sourcemod/scripting/admin-tools.sp

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Plugin:myinfo = {
5454
name = "Admin Tools",
5555
author = "Chanz, Berni",
5656
description = "Collection of mighty admin commands",
57-
version = "1.5",
57+
version = "1.6",
5858
url = "http://bcserv.eu/"
5959
}
6060

@@ -998,7 +998,7 @@ public Action:Command_Score(client, args) {
998998
client,
999999
target_list,
10001000
sizeof(target_list),
1001-
COMMAND_FILTER_ALIVE,
1001+
COMMAND_FILTER_CONNECTED,
10021002
target_name,
10031003
sizeof(target_name),
10041004
tn_is_ml
@@ -1054,7 +1054,7 @@ public Action:Command_Deaths(client, args) {
10541054
client,
10551055
target_list,
10561056
sizeof(target_list),
1057-
COMMAND_FILTER_ALIVE,
1057+
COMMAND_FILTER_CONNECTED,
10581058
target_name,
10591059
sizeof(target_name),
10601060
tn_is_ml
@@ -1113,7 +1113,7 @@ public Action:Command_Connect(client, args) {
11131113
client,
11141114
target_list,
11151115
sizeof(target_list),
1116-
COMMAND_FILTER_ALIVE,
1116+
COMMAND_FILTER_CONNECTED,
11171117
target_name,
11181118
sizeof(target_name),
11191119
tn_is_ml
@@ -2236,7 +2236,7 @@ public Action:Command_Money(client, args) {
22362236
client,
22372237
target_list,
22382238
sizeof(target_list),
2239-
COMMAND_FILTER_ALIVE,
2239+
COMMAND_FILTER_CONNECTED,
22402240
target_name,
22412241
sizeof(target_name),
22422242
tn_is_ml
@@ -2307,7 +2307,7 @@ public Action:Command_KSay(client, args) {
23072307
client,
23082308
target_list,
23092309
sizeof(target_list),
2310-
COMMAND_FILTER_ALIVE,
2310+
COMMAND_FILTER_CONNECTED,
23112311
target_name,
23122312
sizeof(target_name),
23132313
tn_is_ml
@@ -2504,6 +2504,48 @@ public Action:Command_BalanceTeam(client, args) {
25042504
return Plugin_Handled;
25052505
}
25062506

2507+
public Action:Command_ScrambleTeam(client, args) {
2508+
2509+
new Handle:playerList = CreateArray();
2510+
2511+
LOOP_CLIENTS(player, CLIENTFILTER_TEAMONE||CLIENTFILTER_TEAMTWO) {
2512+
PushArrayCell(playerList, player);
2513+
}
2514+
2515+
new newTeam = TEAM_ONE;
2516+
new size = GetArraySize(playerList);
2517+
while (size > 0) {
2518+
2519+
new pick = Math_GetRandomInt(0, size-1);
2520+
SwitchTeam(GetArrayCell(playerList, pick), newTeam);
2521+
newTeam = (newTeam == TEAM_ONE) ? TEAM_TWO : TEAM_ONE;
2522+
2523+
size--;
2524+
RemoveFromArray(playerList, pick);
2525+
}
2526+
2527+
LogAction(client, -1, "\"%L\" scrambled teams", client);
2528+
AdminToolsShowActivity(client, Plugin_Tag, "Scrambled teams");
2529+
return Plugin_Handled;
2530+
}
2531+
2532+
public Action:Command_SwapTeam(client, args) {
2533+
2534+
LOOP_CLIENTS(player, CLIENTFILTER_INGAMEAUTH) {
2535+
2536+
new oldTeam = GetClientTeam(player);
2537+
if (oldTeam != TEAM_ONE && oldTeam != TEAM_TWO) {
2538+
continue;
2539+
}
2540+
2541+
SwitchTeam(player, (oldTeam == TEAM_ONE) ? TEAM_TWO : TEAM_ONE);
2542+
}
2543+
2544+
LogAction(client, -1, "\"%L\" swapped teams", client);
2545+
AdminToolsShowActivity(client, Plugin_Tag, "Swapped teams");
2546+
return Plugin_Handled;
2547+
}
2548+
25072549
/**************************************************************************************
25082550
M A P
25092551
**************************************************************************************/
@@ -2825,21 +2867,6 @@ public Action:Command_Point(client,args){
28252867
return Plugin_Handled;
28262868
}
28272869

2828-
/**************************************************************************************
2829-
D E P R E C A T E D C O M M A N D S
2830-
**************************************************************************************/
2831-
public Action:Command_Deprecated(client,args){
2832-
2833-
decl String:command[MAX_NAME_LENGTH];
2834-
GetCmdArg(0,command,sizeof(command));
2835-
2836-
if(StrContains(command,"entity",false) != -1){
2837-
PrintToChat(client,"%sCommand '%s' is deprecated, please use sm_input instead!",Plugin_Tag,command);
2838-
}
2839-
2840-
return Plugin_Handled;
2841-
}
2842-
28432870
/**************************************************************************************
28442871
28452872
E V E N T S
@@ -3051,28 +3078,21 @@ RegisterAdminTools(){
30513078
//PluginManager_RegAdminCmd("sm_teamscore", Command_SetTeamScore, ADMFLAG_CUSTOM4, "Sets the score of the target team");
30523079
//PluginManager_RegAdminCmd("sm_setteamscore", Command_SetTeamScore, ADMFLAG_CUSTOM4, "Sets the score of the target team");
30533080
PluginManager_RegAdminCmd("sm_balanceteam", Command_BalanceTeam, ADMFLAG_CUSTOM4, "Balances the teams");
3054-
PluginManager_RegAdminCmd("sm_balanceteams", Command_BalanceTeam, ADMFLAG_CUSTOM4, "Balances the teams");
3055-
//PluginManager_RegAdminCmd("sm_mixteam", Command_ScrambleTeam, ADMFLAG_CUSTOM4, "Scrambles the teams");
3056-
//PluginManager_RegAdminCmd("sm_scrambleteam", Command_ScrambleTeam, ADMFLAG_CUSTOM4, "Scrambles the teams");
3057-
//PluginManager_RegAdminCmd("sm_swapteam", Command_SwapTeam, ADMFLAG_CUSTOM4, "Swaps the teams");
3081+
PluginManager_RegAdminCmd("sm_scrambleteam", Command_ScrambleTeam, ADMFLAG_CUSTOM4, "Scrambles the teams");
3082+
PluginManager_RegAdminCmd("sm_swapteam", Command_SwapTeam, ADMFLAG_CUSTOM4, "Swaps the teams");
30583083

30593084
// Server
30603085
PluginManager_RegAdminCmd("sm_reloadmap", Command_ReloadMap, ADMFLAG_CUSTOM4, "Reloads the current map");
30613086
PluginManager_RegAdminCmd("sm_extend", Command_ExtendMap, ADMFLAG_CUSTOM4, "Extends the current map");
3062-
//PluginManager_RegAdminCmd("sm_restartround", Command_RestartRound, ADMFLAG_CUSTOM4, "Restarts the round");
3063-
3064-
// Deprecated Commands
3065-
PluginManager_RegAdminCmd("sm_entity", Command_Deprecated, ADMFLAG_CUSTOM4, "Deprecated please use sm_input");
30663087
}
30673088

30683089
RegisterDeveloperTools(){
30693090

3070-
// Invisible actions which non admins can't see/notice
3091+
// Invisible actions which non-admins can't see/notice
30713092
PluginManager_RegAdminCmd("sm_debug", Command_Debug, ADMFLAG_CUSTOM4, "Shows information about the entity you're looking at");
30723093

30733094
// Visible actions which everyone can see/notice
30743095
PluginManager_RegAdminCmd("sm_point", Command_Point, ADMFLAG_CUSTOM4, "Creates an pointing line in the direction you're looking at");
3075-
30763096
}
30773097

30783098

0 commit comments

Comments
 (0)