Snouty | 2011-04-23 11:21
Easy clanwar command
This script creates a command with which you easily can start clanwars

---------------------------------<><><> UPDATE<><><>---------------------------------

German version now available on http://www.snouty.ch/.

---------------------------------<><><> UPDATE <><><>---------------------------------

This script creates the "/clanwar" command. You have to define 6 parameters.

The command is /clanwar. The syntax is

/clanwar <Team 1> <Team 2> <Amount of players> <Mode> <Map> <Kill all players on start (1 or 0)> <Coerce the clanwar, regardless of master / admin state (opt., 1 or 0)>

  • Team 1, Team 2: Clannames of both clans, written by the tags (like "}JG{" or "CH|").
  • Amount of players: How many players play per clan.
  • Mode: Gamemode. For Insta CTF choose "instactf", for Instagib Team choose "instateam" etc.
  • Map: Name of the map
  • Kill all players on start: After the map loaded, all players get autokilled. I recommend it, because the players switch the team automatically and sometimes it leads to an error, for example spawning in the enemy base.
  • Coerce the clanwar: Some servers return 0 on (getmaster) or (getadmin), even though the player is master / admin. With this optional argument you can coerce the command to start a clanwar, regardless of master / admin state.

The script checks at the start, if you are master / admin, if the syntax is correct, and if there are enough players for each clan. I know, there are still some bugs, but I'll try to fix them.

Have fun!

listclanmembers = [ // List all members in clan $arg1 and define how many players should max listed in $arg2
	returnvalue = "";
	counter = 0;
	looplist i (listclients 1) [ // Check all clients
		if (! (strcmp (strreplace (getclientname $i) $arg1 "") (getclientname $i))) [ // Current player has $arg1 in his name
			if (< $counter $arg2) [ // Execute as long as the amount of found players  is less than $arg2
				returnvalue = (concat $returnvalue $i);
				counter = (+ $counter 1);
			];
		];
	];
	result (substr $returnvalue 1);
];

clanwar = [ // Create command
	if (>= $numargs 6) [ // There must be declared 6 params at minimum
		if (&& (! (ismaster)) (! (isadmin)) (! $arg7)) [ // Not master and not admin and the player doesn't coerce the clanwar
			echo "^f6[ WARNING ]^f7 You are not master or admin. A privileged position is required for this command.";
		] [ // Is master or admin or the player coerces the clanwar
			if (!= (listlen (listclanmembers $arg1 $arg3)) (listlen (listclanmembers $arg2 $arg3))) [ // Different amount of players in the teams
				if (< (listlen (listclanmembers $arg1 $arg3)) (listlen (listclanmembers $arg2 $arg3))) [ // Team 1 has less players than team 2
					echo (concatword "^f6[ WARNING ]^f7 Team '^f3" $arg1 "^f7' has not enough players (" $arg3 " players required, " (listlen (listclanmembers $arg1 $arg3)) " online).");
				] [ // Team 2 has less players than team 1
					echo (concatword "^f6[ WARNING ]^f7 Team '^f3" $arg2 "^f7' has not enough players (" $arg3 " players required, " (listlen (listclanmembers $arg2 $arg3)) " online).");
				];
			] [ // Everything right, execute the settings now
				mastermode 2;
				looplist i (listclients 1) [ // Spectate all players
					spectator 1 $i;
				];
				teams = (concat $arg1 $arg2);
				loop x 2 [ // Execute this twice
					unspectedplayers = 0;
					looplist i (listclanmembers (at $teams $x) $arg3) [ // Execute this for the clanmembers in team 1 / team 2
						if (< $unspectedplayers $arg3) [ // Unspec the amount of players which is defined in $arg3 for each team
							spectator 0 $i;
							unspectedplayers = (+ $unspectedplayers 1);
						];
					];
				];
				$arg4 $arg5
				loop x 2 [ // Execute this twice
					looplist i (listclanmembers (at $teams $x) $arg3) [ // Execute this for the clanmembers in team 1 / team 2 who got unspected
						if (!= (getclientnum) $i) [ // Current client is not me, use command "setteam"
							setteam $i (at "good evil" $x);
						] [ // Current client is me, use command "team"
							team (at "good evil" $x);
						];
					];
				];
				if ($arg6) [ // Kill all players on start?
					looplist i (concat (listclanmembers $arg1 $arg3) (listclanmembers $arg2 $arg3)) [ // Kill the players who got unspected
						spectator 1 $i;
						spectator 0 $i;
					];
				];
			];
		];
	] [ // There aren't 6 params declared!
		echo "^f1[ INFO ]^f7 Right syntax for '^f0/clanwar^f7': <Team 1> <Team 2> <Amount of players> <Mode> <Map> <Kill all players on start (1 or 0)> <Coerce the clanwar, regardless of master / admin state (opt.)>";
	];
];
clanwar.cfg (3.07 KB)
0
points
 (0 votes)
User login
Users on Quadropolis
1 guest & no users online
47
points ]
 (5 votes)
Created 2018-12-04 15:12
1 year 41 weeks ago
10
points ]
 (1 vote)
Created 2020-09-15 02:22
2 days 11 hours ago
Created 2020-09-12 23:14
4 days 14 hours ago
17
points ]
 (2 votes)
Created 2020-09-09 19:44
1 week 18 hours ago
51
points ]
 (11 votes)
Created 2011-12-26 12:13
8 years 38 weeks ago
7YearBitch
8
points ]
 (1 vote)
Created 2020-08-31 19:37
2 weeks 2 days ago
12
points ]
 (2 votes)
Created 2020-08-23 08:32
3 weeks 4 days ago
40
points ]
 (4 votes)
Created 2018-09-17 02:06
2 years 1 day ago
Getridou
10
points ]
 (1 vote)
Created 2020-08-08 12:36
5 weeks 5 days ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
13 weeks 4 days ago
40
points ]
 (5 votes)
Created 2015-08-25 10:17
5 years 3 weeks ago
Getridou
10
points ]
 (1 vote)
Created 2020-07-21 04:52
8 weeks 2 days ago
Getridou
27
points ]
 (3 votes)
Created 2020-07-19 01:19
8 weeks 4 days ago
43
points ]
 (5 votes)
Created 2020-06-27 11:13
11 weeks 5 days ago
Gangler
19
points ]
 (2 votes)
Created 2020-07-13 20:42
9 weeks 2 days ago
68
points ]
 (8 votes)
Created 2018-07-12 17:59
2 years 9 weeks ago
Created 2020-05-14 12:56
18 weeks 1 hour ago
102
points ]
 (12 votes)
Created 2011-05-17 17:36
9 years 17 weeks ago
Getridou
48
points ]
 (5 votes)
Created 2020-07-02 18:52
10 weeks 6 days ago
LURKing
27
points ]
 (3 votes)
Created 2020-07-01 13:16
11 weeks 1 day ago
Who's new
  • Getridou
  • Spr1te
  • Akari
  • LURKing
  • Antknee55