Advertisement
Guest User

Untitled

a guest
Jan 14th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ChatAdminPlayerCharacterController extends Gameplay.PlayerCharacterController;
  2.  
  3. function printCommandForPosterity(bool isAdmin, string command) {
  4.     local string name;
  5.  
  6.     if(isAdmin) {
  7.         name = "[admin|" $ PlayerReplicationInfo.PlayerName $ "]";
  8.     } else {
  9.         name = "[" $ PlayerReplicationInfo.PlayerName $ "]";
  10.     }
  11.  
  12.     super.Say("!" $ command);
  13.  
  14.     // Following does not seem to work for any other commands than admin
  15.     // Level.Game.Broadcast(self, name @ command, 'Say');
  16.     // MultiplayerGameInfo(Level.Game).Broadcast(Level.Game, name @ command, 'say');
  17. }
  18.  
  19. function bool isCommandAuthorized(string command) {
  20.     if(command == "get" || command == "set") {
  21.         return false;
  22.     }
  23.  
  24.     return true;
  25. }
  26.  
  27. exec function Admin(string cmd)
  28. {
  29.     local string cmdCommand;
  30.     local string cmdLower;
  31.     local string fullCmd;
  32.  
  33.     fullCmd = "admin" @ cmd;
  34.     cmdLower = Locs(cmd);
  35.     cmdCommand = Left(cmdLower, InStr(cmdLower, " "));
  36.    
  37.     if (isCommandAuthorized(cmdCommand) && AdminManager != None) {
  38.         Log("[ChatAdminPlayerCharacterController] Admin command executed" @ cmd);
  39.         printCommandForPosterity(true, fullCmd);
  40.         ConsoleCommand(cmd);
  41.     }
  42. }
  43.  
  44. exec function AdminLogin(string usernameAndPassword) {
  45.     local string username;
  46.  
  47.     username = Left(Locs(usernameAndPassword), InStr(Locs(usernameAndPassword), " "));
  48.     Log("[ChatAdminPlayerCharacterController] Adminlogin" @ PlayerReplicationInfo.PlayerName @ "as" @ username);
  49.  
  50.     if(InStr(Locs(PlayerReplicationInfo.PlayerName), Locs(username)) > -1) {
  51.         super.AdminLogin(usernameAndPassword);
  52.     }
  53. }
  54.  
  55. exec function Name(coerce string newname) {
  56.     printCommandForPosterity(false, "name" @ newname);
  57.     super.AdminLogout();
  58.     super.Name(newname);
  59. }
  60.  
  61. exec function kickvote(string name) {
  62.     printCommandForPosterity(false, "kickvote" @ name);
  63.     super.kickvote(name);
  64. }
  65.  
  66. exec function mapvote(string map, string gametype) {
  67.     super.mapvote(map, gametype);
  68.     printCommandForPosterity(false, "mapvote" @ map @ gametype);
  69. }
  70.  
  71. exec function teamdamagevote(bool vote) {
  72.     super.teamdamagevote(vote);
  73.     printCommandForPosterity(false, "teamdamagevote" @ vote);
  74. }
  75.  
  76. exec function tournamentvote(bool vote) {
  77.     super.tournamentvote(vote);
  78.     printCommandForPosterity(false, "tournamentvote" @ vote);
  79. }
  80.  
  81. defaultProperties {
  82.    
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement