Author Topic: Server commands lister  (Read 3643 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Server commands lister
« on: June 04, 2007, 10:48:05 am »
Script Name: Server commands lister
Script Description: When you use /servercommands, /servercommandsA, /servercommandsB; you will get a list of the server commands.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.1
Code:
Code: [Select]
var
  Commands: TStringArray;

procedure ActivateServer();
begin
  SetArrayLength(Commands,39);
  Commands[1] := '  Command          A; B; C; etc    Description';
  Commands[2] := ' Server commands:';
  Commands[3] := '/addbotA B         Team; Bot name  Adds a bot';
  Commands[4] := '/kick A            ID or name      Kicks somebody';
  Commands[5] := '/ban A             ID or name      Bans somebody';
  Commands[6] := '/banip A           IP              Bans an IP';
  Commands[7] := '/unban A           IP              Unbans an IP';
  Commands[8] := '/map A             Map name        Forces a map change';
  Commands[9] := '/restart                           Restarts the current match';
  Commands[10] := '/nextmap                           Forces the map to change to the next in mapslist.txt';
  Commands[11] := '/adm A             Name            Adds a player to the remote admins list';
  Commands[12] := '/admip A           IP              Adds an IP to the remote admins list';
  Commands[13] := '/unadm A           IP              Removes an UP from the remote admins list';
  Commands[14] := '/say A             Message         Sends a text messsage to all players in the server';
  Commands[15] := '/setteamA B        Team; ID        Forces a player to a team';
  Commands[16] := '/kicklast                          Kicks the last player who joined the server';
  Commands[17] := '/respawntime A     Seconds         Sets the respawn time';
  Commands[18] := '/maxrespawntime A  Seconds         Sets the maximum respawn time in team games';
  Commands[19] := '/limit A           Value           Sets the capture/kills/point limit';
  Commands[20] := ' Type /servercommandsB to view the second page.';
  Commands[21] := '/timelimit A       Minutes         Sets the time limit';
  Commands[22] := '/friendlyfire A    0/1             Enables (1) / Disables (0) friendly fire';
  Commands[23] := '/vote% A           Percent         Sets the vote percent needed to be sucessful';
  Commands[24] := '/bonus A           1-5             Sets the frequency o bonus (0 = never, 5 = max)';
  Commands[25] := '/maxplayers A      1-32            Sets the maximim players allowed in the server';
  Commands[26] := '/loadcon                           Reloads soldat.ini';
  Commands[27] := '/loadwep A         File.ini        Loads A.ini into the weapon settings';
  Commands[28] := '/gamemode A        1-6             Sets the gamemode (0 = DM, 1 = PM, 2 = TM, 3 = CTF, 4 = RM, 5 = INF, 6 = HTF';
  Commands[29] := '/realistic A       0/1             Enables (1) / Disables (0) realitsic mode';
  Commands[30] := '/advanced A        0/1             Enables (1) / Disables (0) advanced mode';
  Commands[31] := '/survival A        0/1             Enables (1) / Disables (0) survival mode';
  Commands[32] := '/kill A            ID or name      Forces a player to selfkill';
  Commands[33] := '/banlast                           Bans the last person who joined the server for one hour';
  Commands[34] := '/unbanlast                         Unbans the last player who was banned';
  Commands[35] := '/adminpass A       Password        Changes the remote admin password';
  Commands[36] := '/adminlog A        Password        Logs the client as remote admin';
  Commands[37] := '/mute A            ID or name      Mutes the player so you don''t see his chat';
  Commands[38] := '/unmute A          ID or name      Unmutes a player';
  Commands[39] := ' Type /servercommandsA to view the first page.';
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
Result := false
  if LowerCase(Text) = '/servercommandsa' then for i := 1 to 20 do SaytoPlayer(ID,Commands[i]);
  if LowerCase(Text) = '/servercommandsb' then for i := 21 to ArrayHigh(Commands) do SaytoPlayer(ID,Commands[i]);
end;
« Last Edit: June 04, 2007, 10:23:24 pm by DorkeyDear »

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Server commands lister
« Reply #1 on: June 04, 2007, 11:14:41 am »
Is it really necessary to assign everything on /recompile?
If so, i suggest that you make a helper procedure to initialize the array, and call it on both OnComman and ActivateServer

PD: Ah, and i think you forgot the declaration of the array.
urraka

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Server commands lister
« Reply #2 on: June 04, 2007, 11:16:22 am »
I thought when somebody does /recompile, all the variables are reset..
*edits* it so it sets them on a separate procedure.
*edits* oops, i got the array declared now :).. I often forget to copy that over from the .pas file.
« Last Edit: June 04, 2007, 11:20:32 am by DorkeyDear »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Server commands lister
« Reply #3 on: June 04, 2007, 05:28:57 pm »
Recompiling does reset variables, but it also calls ActivateServer again so you don't need to call SetCommands() twice.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Server commands lister
« Reply #4 on: June 04, 2007, 10:22:50 pm »
:) Didn't know that. I learn something new every day! *edits*