1- using System . Diagnostics . CodeAnalysis ;
2- using CounterStrikeSharp . API ;
1+ using CounterStrikeSharp . API ;
32using CounterStrikeSharp . API . Core ;
43using CounterStrikeSharp . API . Core . Attributes . Registration ;
54using CounterStrikeSharp . API . Modules . Utils ;
6- using System . Text . Json . Serialization ;
75using CounterStrikeSharp . API . Modules . Admin ;
86using CounterStrikeSharp . API . Modules . Commands ;
97using CounterStrikeSharp . API . Modules . Cvars ;
10- using CounterStrikeSharp . API . Modules . Entities ;
118using CounterStrikeSharp . API . Modules . Memory ;
129
1310namespace BasicAdmin ;
1411
15- internal struct OriginalVec
16- {
17- internal Vector Position ;
18- internal QAngle Rotation ;
19- internal Vector Velocity ;
20- }
21-
2212public class BasicAdmin : BasePlugin , IPluginConfig < BasicAdminConfig >
2313{
2414 public override string ModuleName => "BasicAdmin" ;
@@ -27,9 +17,6 @@ public class BasicAdmin : BasePlugin, IPluginConfig<BasicAdminConfig>
2717
2818 public BasicAdminConfig Config { get ; set ; } = new ( ) ;
2919
30- private static readonly Dictionary < CCSPlayerController , OriginalVec > OriginalPositions = new ( ) ;
31-
32-
3320 public void OnConfigParsed ( BasicAdminConfig config )
3421 {
3522 this . Config = config ;
@@ -76,7 +63,7 @@ public void OnKickCommand(CCSPlayerController? caller, CommandInfo info)
7663 ServerUtils . KickPlayer ( player ! . UserId , reason ) ;
7764
7865 if ( ! Config . HideActivity )
79- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } kicked { player ! . PlayerName } .") ) ;
66+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } kicked { player . PlayerName } .") ) ;
8067 }
8168
8269 [ ConsoleCommand ( "css_slay" , "Slay a player." ) ]
@@ -93,7 +80,7 @@ public void OnSlayCommand(CCSPlayerController? caller, CommandInfo info)
9380 player ! . Pawn . Value . CommitSuicide ( false , true ) ;
9481
9582 if ( ! Config . HideActivity )
96- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } slayed { player ! . PlayerName } .") ) ;
83+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } slayed { player . PlayerName } .") ) ;
9784 }
9885
9986 [ ConsoleCommand ( "css_give" , "Give a player an item." ) ]
@@ -110,7 +97,7 @@ public void OnGiveCommand(CCSPlayerController? caller, CommandInfo info)
11097 player ! . GiveNamedItem ( info . GetArg ( 2 ) ) ;
11198
11299 if ( ! Config . HideActivity )
113- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } gave { player ! . PlayerName } { ChatColors . Lime } { info . GetArg ( 2 ) } { ChatColors . Default } .") ) ;
100+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } gave { player . PlayerName } { ChatColors . Lime } { info . GetArg ( 2 ) } { ChatColors . Default } .") ) ;
114101 }
115102
116103 [ ConsoleCommand ( "css_swap" , "Swap a player." ) ]
@@ -130,12 +117,12 @@ public void OnSwapCommand(CCSPlayerController? caller, CommandInfo info)
130117 return ;
131118 }
132119
133- var isCs = player ! . TeamNum == ( int ) CsTeam . CounterTerrorist ;
120+ var isCs = player . TeamNum == ( int ) CsTeam . CounterTerrorist ;
134121
135- player ! . ChangeTeam ( isCs ? CsTeam . Terrorist : CsTeam . CounterTerrorist ) ;
122+ player . ChangeTeam ( isCs ? CsTeam . Terrorist : CsTeam . CounterTerrorist ) ;
136123
137124 if ( ! Config . HideActivity )
138- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } swapped { player ! . PlayerName } .") ) ;
125+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } swapped { player . PlayerName } .") ) ;
139126 }
140127
141128 [ ConsoleCommand ( "css_spec" , "Change a player to spec." ) ]
@@ -152,7 +139,7 @@ public void OnSpecCommand(CCSPlayerController? caller, CommandInfo info)
152139 player ! . ChangeTeam ( CsTeam . Spectator ) ;
153140
154141 if ( ! Config . HideActivity )
155- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } moved { player ! . PlayerName } to spec.") ) ;
142+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } moved { player . PlayerName } to spec.") ) ;
156143 }
157144
158145 // [ConsoleCommand("css_respawn", "Respawn a dead player.")]
@@ -195,7 +182,7 @@ public void OnAdminPrivateSayCommand(CCSPlayerController? caller, CommandInfo in
195182 var message = info . GetCommandString [ range ..] ;
196183
197184 info . ReplyToCommand ( FormatAdminMessage ( $ "({ player ! . PlayerName } ) { message } ") ) ;
198- player ! . PrintToChat ( FormatAdminMessage ( $ "({ caller ! . PlayerName } ) { message } ") ) ;
185+ player . PrintToChat ( FormatAdminMessage ( $ "({ caller ! . PlayerName } ) { message } ") ) ;
199186 }
200187
201188 [ ConsoleCommand ( "css_csay" , "Say to all players (in center)." ) ]
@@ -257,13 +244,13 @@ public void OnBuryCommand(CCSPlayerController? caller, CommandInfo info)
257244 return ;
258245 }
259246
260- var newPos = new Vector ( player ! . Pawn . Value . AbsOrigin ! . X , player ! . Pawn . Value . AbsOrigin ! . Y ,
261- player ! . Pawn . Value . AbsOrigin ! . Z - 10f ) ;
247+ var newPos = new Vector ( player . Pawn . Value . AbsOrigin ! . X , player . Pawn . Value . AbsOrigin . Y ,
248+ player . Pawn . Value . AbsOrigin . Z - 10f ) ;
262249
263- player ! . Pawn . Value . Teleport ( newPos , player ! . AbsRotation ! , player ! . AbsVelocity ) ;
250+ player . Pawn . Value . Teleport ( newPos , player . AbsRotation ! , player . AbsVelocity ) ;
264251
265252 if ( ! Config . HideActivity )
266- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } buried { player ! . PlayerName } .") ) ;
253+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } buried { player . PlayerName } .") ) ;
267254 }
268255
269256 [ ConsoleCommand ( "css_unbury" , "Unbury a player." ) ]
@@ -277,13 +264,13 @@ public void OnUnburyCommand(CCSPlayerController? caller, CommandInfo info)
277264 return ;
278265 }
279266
280- var newPos = new Vector ( player ! . Pawn . Value . AbsOrigin ! . X , player ! . Pawn . Value . AbsOrigin ! . Y ,
281- player ! . Pawn . Value . AbsOrigin ! . Z + 15f ) ;
267+ var newPos = new Vector ( player ! . Pawn . Value . AbsOrigin ! . X , player . Pawn . Value . AbsOrigin . Y ,
268+ player . Pawn . Value . AbsOrigin ! . Z + 15f ) ;
282269
283- player ! . Pawn . Value . Teleport ( newPos , player ! . AbsRotation ! , player ! . AbsVelocity ) ;
270+ player . Pawn . Value . Teleport ( newPos , player . AbsRotation ! , player . AbsVelocity ) ;
284271
285272 if ( ! Config . HideActivity )
286- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } unburied { player ! . PlayerName } .") ) ;
273+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } unburied { player . PlayerName } .") ) ;
287274 }
288275
289276 [ ConsoleCommand ( "css_disarm" , "Disarm a player." ) ]
@@ -300,7 +287,7 @@ public void OnDisarmCommand(CCSPlayerController? caller, CommandInfo info)
300287 player ! . RemoveWeapons ( ) ;
301288
302289 if ( ! Config . HideActivity )
303- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } disarmed { player ! . PlayerName } .") ) ;
290+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } disarmed { player . PlayerName } .") ) ;
304291 }
305292
306293 [ ConsoleCommand ( "css_hp" , "Change a player's HP." ) ]
@@ -317,7 +304,7 @@ public void OnHealthCommand(CCSPlayerController? caller, CommandInfo info)
317304 player ! . Pawn . Value . Health = health ;
318305
319306 if ( ! Config . HideActivity )
320- Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } changed { player ! . PlayerName } 's health to { health } .") ) ;
307+ Server . PrintToChatAll ( FormatAdminMessage ( $ "{ caller ! . PlayerName } changed { player . PlayerName } 's health to { health } .") ) ;
321308 }
322309
323310 [ ConsoleCommand ( "css_cvar" , "Change a cvar." ) ]
@@ -333,7 +320,7 @@ public void OnCvarCommand(CCSPlayerController? caller, CommandInfo info)
333320 return ;
334321 }
335322
336- if ( cvar . Name . Equals ( "sv_cheats" ) && ! AdminManager . PlayerHasPermissions ( caller , "@css/cvar " ) )
323+ if ( cvar . Name . Equals ( "sv_cheats" ) && ! AdminManager . PlayerHasPermissions ( caller , "@css/cheats " ) )
337324 {
338325 info . ReplyToCommand ( FormatMessage ( $ "You don't have permissions to change \" { info . GetArg ( 1 ) } \" .") ) ;
339326 return ;
0 commit comments