Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 |
//============================================================================= // Admin Access Manager - Simple control class to manage what cheat // codes a client may use. //============================================================================= Class AdminAccessManager extends Info; var localized string AdminLoginText,AdminLogoutText,CheatUsedStr; var() globalconfig bool bLogCheatUseage; struct FConnectionInfo { var string DLFileName; var int DLSent,DLTotalSize; var NetConnection CON; }; function AdminLogin( PlayerPawn Other ) { Other.bAdmin = true; Log(ReplaceStr(AdminLoginText,"%s",Other.GetHumanName()),Class.Name); } function AdminLogout( PlayerPawn Other ) { if( Other==None || !Other.bAdmin ) return; Other.bAdmin = false; Log(ReplaceStr(AdminLogoutText,"%s",Other.GetHumanName()),Class.Name); } function bool AtCapacity( bool bSpectator, out string Error ) { if( Level.NetMode==NM_StandAlone ) return false; if( bSpectator && (Level.Game.NumSpectators>=Level.Game.MaxSpectators) ) { Error = "Max spectators exceeded"; return true; } else if( !bSpectator && Level.Game.MaxPlayers>0 && (Level.Game.NumPlayers>=Level.Game.MaxPlayers) ) { Error = Level.Game.MaxedOutMessage; return true; } return false; } function bool CanExecuteCheat( PlayerPawn Other, name N ) { if( !Other.bAdmin && NetConnection(Other.Player)!=None ) return false; if( bLogCheatUseage ) Log(ReplaceStr(ReplaceStr(CheatUsedStr,"%s",Other.GetHumanName()),"%c",string(N)),Class.Name); return true; } function bool CanExecuteCheatStr( PlayerPawn Other, name N, string Parms ) { if( !Other.bAdmin && NetConnection(Other.Player)!=None ) return false; if( bLogCheatUseage ) Log(ReplaceStr(ReplaceStr(CheatUsedStr,"%s",Other.GetHumanName()),"%c",N@Parms),Class.Name); return true; } function InitGame( string Options, out string Error ); function GetConnections( optional PlayerPawn Executer ) { local NetConnection CON; local NetConnection DLCON; local string IP; local string Options; local string InName; local string StateString; local string ConString; local byte ConState; local int Port; local int X,Y; local string FileName; local int Sent; local int TotalSize; local array<FConnectionInfo> CacheInfo; local float percent; local string Output; local bool bGotDownloaders,bDownloader; ForEach Level.AllConnections(CON) { IP=Level.GetConIP(CON,Port); Options="?"$Level.GetConOpts(CON); if (CON.Actor == None) InName = Level.Game.ParseOption(Options,"Name"); else InName = CON.Actor.GetHumanName(); ConState = Level.GetConState(CON); if (ConState < 2) continue; //No need to broadcast.. else if (ConState == 2) StateString = "Pending"; else StateString = "Open"; if (CON.Actor == None) //check for connections without actors(downloading or connecting) { if (!bGotDownloaders) { // if we do this here, we iterate the list once, instead of how many times there are new connections. ForEach Level.AllDownloaders(DLCON,FileName,Sent,TotalSize) { CacheInfo[Y].CON = DLCON; CacheInfo[Y].DLFileName = Filename; CacheInfo[Y].DLSent = Sent/1024; CacheInfo[Y].DLTotalSize = TotalSize/1024; ++Y; } bGotDownloaders=True; } for ( X=0; X<Y; X++ ) //X is used again to determine wich array index on this iteration with downloader. { if( CacheInfo[X].CON==CON ) { ConString="(Downloading)"; bDownloader=True; break; } } if ( !bDownloader ) ConString="(Connecting)";//Always connecting, if not downloading. } if (bDownloader) { Percent = (float(CacheInfo[X].DLSent)/float(CacheInfo[X].DLTotalSize))*100;//convert to float to fix division errors Output = "Conn #"$CON$":"@IP$":"$Port@InName@"Down:"@CacheInfo[X].DLFileName@CacheInfo[X].DLSent$"/"$CacheInfo[X].DLTotalSize$"kb"@percent$"%"@"State:"@StateString@ConString; bDownloader = False;//reset } else { Output = "Conn #"$CON$":"@IP$":"$Port@InName@"State:"@StateString; if( CON.Actor!=None && CON.Actor.bAdmin ) Output = Output$"(Admin)"; } Log(Output,Class.Name); if( Executer!=None ) Executer.ClientMessage(Output); } } defaultproperties { AdminLoginText="Administrator %s logged in" AdminLogoutText="Administrator %s logged out" CheatUsedStr="%s used admin/cheat command: %c" RemoteRole=ROLE_None } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |