Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ChatAdminPlayerCharacterController extends Gameplay.PlayerCharacterController;
- function printCommandForPosterity(bool isAdmin, string command) {
- local string name;
- if(isAdmin) {
- name = "[admin|" $ PlayerReplicationInfo.PlayerName $ "]";
- } else {
- name = "[" $ PlayerReplicationInfo.PlayerName $ "]";
- }
- super.Say("!" $ command);
- // Following does not seem to work for any other commands than admin
- // Level.Game.Broadcast(self, name @ command, 'Say');
- // MultiplayerGameInfo(Level.Game).Broadcast(Level.Game, name @ command, 'say');
- }
- function bool isCommandAuthorized(string command) {
- if(command == "get" || command == "set") {
- return false;
- }
- return true;
- }
- exec function Admin(string cmd)
- {
- local string cmdCommand;
- local string cmdLower;
- local string fullCmd;
- fullCmd = "admin" @ cmd;
- cmdLower = Locs(cmd);
- cmdCommand = Left(cmdLower, InStr(cmdLower, " "));
- if (isCommandAuthorized(cmdCommand) && AdminManager != None) {
- Log("[ChatAdminPlayerCharacterController] Admin command executed" @ cmd);
- printCommandForPosterity(true, fullCmd);
- ConsoleCommand(cmd);
- }
- }
- exec function AdminLogin(string usernameAndPassword) {
- local string username;
- username = Left(Locs(usernameAndPassword), InStr(Locs(usernameAndPassword), " "));
- Log("[ChatAdminPlayerCharacterController] Adminlogin" @ PlayerReplicationInfo.PlayerName @ "as" @ username);
- if(InStr(Locs(PlayerReplicationInfo.PlayerName), Locs(username)) > -1) {
- super.AdminLogin(usernameAndPassword);
- }
- }
- exec function Name(coerce string newname) {
- printCommandForPosterity(false, "name" @ newname);
- super.AdminLogout();
- super.Name(newname);
- }
- exec function kickvote(string name) {
- printCommandForPosterity(false, "kickvote" @ name);
- super.kickvote(name);
- }
- exec function mapvote(string map, string gametype) {
- super.mapvote(map, gametype);
- printCommandForPosterity(false, "mapvote" @ map @ gametype);
- }
- exec function teamdamagevote(bool vote) {
- super.teamdamagevote(vote);
- printCommandForPosterity(false, "teamdamagevote" @ vote);
- }
- exec function tournamentvote(bool vote) {
- super.tournamentvote(vote);
- printCommandForPosterity(false, "tournamentvote" @ vote);
- }
- defaultProperties {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement