/* AMXMOD script.
*
* (c) Copyright 2000-2002, f117bomb
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

/*
* amx_stack < part of nick > [ type (default=vertical, 1=horizontal ) ]
*
*/

public admin_stack(id)
{
	if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
		client_print(id,print_console,"[AMX] You have no access to that command")
		return PLUGIN_HANDLED
	}
	new argc = read_argc()
	if (argc < 2) {
		client_print(id,print_console,"[AMX] Usage:  amx_stack < part of nick > [ type (default=vertical, 1=horizontal ) ] ")
		return PLUGIN_HANDLED
	}
	new name[32]
	new type[12]
	read_argv(1,name,32)
	read_argv(2,type,12)
	new player= find_player("b",name)
	if (player)	{
		if (get_user_flags(player)&ADMIN_IMMUNITY) {
			client_print(id,print_console,"[AMX] The player has immunity")
			return PLUGIN_HANDLED
		}
		new origin[3]
		get_user_origin(player, origin)
		new inum, players[32]
		get_players(players,inum,"a")
		for(new i = 0 ;i < inum ; ++i)
		{
			if (str_to_num(type) == 0)
			{
				if (players[i] != player)
				{
					origin[2] += 96 
					set_user_origin(players[i], origin)
				}
			}
			else if (str_to_num(type) == 1)
			{
				if (players[i] != player)
				{
					origin[1] += 36 
					set_user_origin(players[i], origin)
				}
			}
		}
		get_user_name(player,name,32)
		client_print(id,print_console,"[AMX] Client ^"%s^" has had all players stacked on top of him",name)
	}
	else {
		client_print(id,print_console,"[AMX] Client with that part of nick not found")
	}
	return PLUGIN_HANDLED
}

public plugin_init()
{
	register_plugin("Admin Stack","0.6","f117bomb")
	register_clcmd("amx_stack","admin_stack",ADMIN_LEVEL_A,"amx_stack < part of nick > [ type ( default=vertical , 1=horizontal ) ]")
	return PLUGIN_CONTINUE
}

