0 Members and 1 Guest are viewing this topic.
ConstSPACES = ' '; //spaces before and after the valueCOMMAND = '/showinfo'; //the command for showing the server infoSPAMTIME = 5; //how many minutes a player has to wait to show server infoCOLOR = $FFFFFFFF; //the color of the messagesVarSpamTimer: array[1..32] of integer;CanShowInfo : array[1..32] of boolean;procedure ShowInfo(ID: byte);begin WriteConsole(ID,'Server Name:'+SPACES+ReadINI('soldat.ini','NETWORK','Server_Name','*ERROR*')+SPACES,COLOR); Case ReadINI('soldat.ini','GAME','Gamestyle','*ERROR*') of '0': begin WriteConsole(ID,'GameMode:'+SPACES+'DeathMatch'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Deathmatch_Limit','*ERROR*')+SPACES,COLOR); end '1': begin WriteConsole(ID,'GameMode:'+SPACES+'PointMatch'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Pointmatch_Limit','*ERROR*')+SPACES,COLOR); end '2': begin WriteConsole(ID,'GameMode:'+SPACES+'TeamMatch'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Teammatch_Limit','*ERROR*')+SPACES,COLOR); end '3': begin WriteConsole(ID,'GameMode:'+SPACES+'Capture The Flag'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Capture_Limit','*ERROR*')+SPACES,COLOR); end '4': begin WriteConsole(ID,'GameMode:'+SPACES+'RamboMatch'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Rambomatch_Limit','*ERROR*')+SPACES,COLOR); end '5': begin WriteConsole(ID,'GameMode:'+SPACES+'Infiltration'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Infiltration_Limit','*ERROR*')+SPACES,COLOR); end '6': begin WriteConsole(ID,'GameMode:'+SPACES+'Hold The Flag'+SPACES,COLOR); WriteConsole(ID,'Score Limit:'+SPACES+ReadINI('soldat.ini','GAME','Hold_Limit','*ERROR*')+SPACES,COLOR); end end WriteConsole(ID,'Time Limit:'+SPACES+ReadINI('soldat.ini','GAME','Time_Limit','*ERROR*')+SPACES,COLOR); WriteConsole(ID,'Max Players:'+SPACES+ReadINI('soldat.ini','GAME','Max_Players','*ERROR*')+SPACES,COLOR); WriteConsole(ID,'Max Spectators:'+SPACES+ReadINI('soldat.ini','NETWORK','Max_Spectators','*ERROR*')+SPACES,COLOR); WriteConsole(ID,'Respawn Time:'+SPACES+ReadINI('soldat.ini','GAME','Respawn_Time','*ERROR*')+SPACES,COLOR); WriteConsole(ID,'Wave Respawn Time:'+SPACES+ReadINI('soldat.ini','GAME','WaveRespawn_Time','*ERROR*')+SPACES,COLOR); Case ReadINI('soldat.ini','GAME','Realistic_Mode','*ERROR*') of '0': WriteConsole(ID,'Realistic: No'+SPACES,COLOR); '1': WriteConsole(ID,'Realistic: Yes'+SPACES,COLOR); end Case ReadINI('soldat.ini','GAME','Survival_Mode','*ERROR*') of '0': WriteConsole(ID,'Survival: No'+SPACES,COLOR); '1': WriteConsole(ID,'Survival: Yes'+SPACES,COLOR); end Case ReadINI('soldat.ini','GAME','Weapons_Mode','*ERROR*') of '0': WriteConsole(ID,'Advanced: No'+SPACES,COLOR); '1': WriteConsole(ID,'Advanced: Yes'+SPACES,COLOR); end WriteConsole(ID,'Bonus Frequency:'+SPACES+ReadINI('soldat.ini','GAME','Bonus_Frequency','*ERROR*')+SPACES,COLOR);end;function OnPlayerCommand(ID: Byte; Text: string): boolean;vari: integer;begin if (Text = COMMAND) then begin if (SpamTimer[ID] > 0) and (CanShowInfo[ID] = true) then begin ShowInfo(ID); i := SPAMTIME*60; SpamTimer[ID] := i; end else WriteConsole(ID,'Please wait '+SPAMTIME+' minutes between showing the server info',COLOR); endend;procedure AppOnIdle(Ticks: integer);vari: integer;begin for i := 1 to 32 do begin if (SpamTimer[i] > 0) and (CanShowInfo[i] = false) then SpamTimer[i] := SpamTimer[i]-1; if SpamTimer[i] = 0 then CanShowInfo[i] := true; endend;procedure ActivateServer();vari: integer;begin for i := 1 to 32 do begin SpamTimer[i] := 0; CanShowInfo[i] := true; endend;
function OnPlayerCommand(ID: Byte; Text: string): boolean;var i: integer;begin if (Text = CMD) then begin if ((SpamTimer[ID] > 0) and (CanShowInfo[ID] = true)) then begin ShowInfo(ID); i:= SPAMTIME * 60; SpamTimer[ID]:= i; end else begin WriteConsole(ID, 'Please wait '+ IntToStr(SPAMTIME) +' minutes between showing the server info', COLOR); end; end;end;