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
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
3 years 21 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
5 weeks 5 days ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
34 weeks 5 days ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 14 weeks ago
Created 2023-12-12 23:34
14 weeks 3 days ago
Zoocata
Created 2023-11-27 23:00
16 weeks 4 days ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
24 weeks 6 days ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
2 years 43 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
40 weeks 3 days ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
46 weeks 19 hours ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 3 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 7 weeks ago
Created 2023-01-19 19:36
1 year 9 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 10 weeks ago
Getridou
Created 2023-01-01 14:30
1 year 11 weeks ago
Getridou
Created 2023-01-01 10:58
1 year 11 weeks ago
Getridou
Created 2023-01-01 10:49
1 year 11 weeks ago
afroninja
17
points ]
 (2 votes)
Created 2023-01-01 06:32
1 year 11 weeks ago
36
points ]
 (7 votes)
Created 2010-04-01 07:57
13 years 51 weeks ago
57
points ]
 (6 votes)
Created 2020-12-04 12:05
3 years 15 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN