#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <xs>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "3Dvid"
#define VERSION "1.0"
#define AUTHOR "MD_SAnTA"


public plugin_init() {
                register_plugin(PLUGIN, VERSION, AUTHOR)
                register_clcmd("fak1", "santa")
                register_clcmd("fack2", "santa2")
                register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0")
                register_clcmd("fack3", "my_menu")
                register_dictionary("servermenu.txt")
}

public EventRoundStart()
{
        for (new i = 1; i <= get_maxplayers(); i++)
        {
                if (!is_user_connected(i))
                        continue
 
                set_view(i, CAMERA_NONE)
        }
       
        client_print(0, print_chat, "Event New Round")
}

public zp_user_infected_post( id, infector, nemesis ){
        if ( is_user_alive( id ) && zp_get_user_zombie( id ) ){
        my_menu(id)
        return PLUGIN_HANDLED
        }

}


public santa(id){
	set_view(id, CAMERA_3RDPERSON)
}

public zp_user_humanized_post(id)
{
         set_view(id, CAMERA_NONE);
}

public santa2(id)
{
         set_view(id, CAMERA_NONE);
}

//Функция цвета в чате
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}

//Функция нашего меню
public my_menu(id)
{
new i_Menu = menu_create("\rМеню сервера:", "server_menu")
//Пункты меню,номера функций, доступ
menu_additem(i_Menu, "\w3D вид", "1", 0)
menu_additem(i_Menu, "\wОбычный режим", "2", 0)

menu_setprop(i_Menu, MPROP_EXIT, MEXIT_ALL)

menu_display(id, i_Menu, 0)

return PLUGIN_HANDLED

}

//Функции нашего меню
public server_menu(id, menu, item)
{

if (item == MENU_EXIT)
{
menu_destroy(menu)

return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback

menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

new i_Key = str_to_num(s_Data)

switch(i_Key)
{

//Значение функций
case 1:
{
client_cmd(id, "fak1")
ChatColor(id, "%L",0,"RS")
}
case 2:
{
client_cmd(id, "fack2")
}
}

menu_destroy(menu)
return PLUGIN_HANDLED

}