Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Team Manger

damirvip3
сообщение 19.2.2015, 15:39
Сообщение #1
Стаж: 11 лет

Сообщений: 67
Благодарностей: 3
Полезность: 0

Помогите у меня проблема с плагином он то работает то нет
Жду зайди за ТТ не заходит
Жду зайди за КТ не заходит
Код:
#include < amxmodx >
#include < cstrike >
#include < fakemeta >

#define PLUGIN "[ JB ] Team Manger"
#define VERSION "0.1"
#define AUTHOR "Opo4uMapy / fl0wer"

#define MSG_SHOWMENU 96

new g_AutoJoin, Float:gametime

new g_BlockTeam[33]
new CountT, CountCT
new idMSGid[33]

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

//Message
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu")
register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu")

//Cvar
g_AutoJoin = register_cvar("jb_autojoin", "1")

//Logevent
register_logevent("on_round_start", 2, "0=World triggered", "1=Round_Start")

//Clcmd
register_clcmd("jointeam", "jointeam")
register_clcmd("joinclass", "jointeam")
register_clcmd("say /team_menu", "team_menu")

register_dictionary("jb_team_manger.txt")

set_task(1.0, "AlivePlayer", _, _, _, "b")
}

public client_command(id)
{
new arg[13]
read_argv(0, arg , 12)

for (new a = 0; a < 34; a++)
{
if(equal("chooseteam", arg) || equal("say /chooseteam", arg))
{
team_menu(id)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}

public message_ShowMenu(iMsgid, iDest, id)
{
static sMenuCode[64]
get_msg_arg_string(4, sMenuCode, sizeof(sMenuCode) - 1)

new Float:gt = get_gametime() - gametime
new Float:rt = get_cvar_float("mp_roundtime") * 60.0

if(equal(sMenuCode, "#Team_Select") || equal(sMenuCode, "#Team_Select_Spect"))
{
if (get_pcvar_num ( g_AutoJoin) == 1)
{
if(gt >= rt - 1.0)
{client_print(id, print_center, "Go to the game will be in the next round"); g_BlockTeam[id] = 1; idMSGid[id]=iMsgid;}
else
set_autojoin_task(id, iMsgid)
}
else
{
team_menu(id)
}
return PLUGIN_HANDLED;

}
return PLUGIN_CONTINUE;
}

public message_VGUIMenu(iMsgid, iDest, id)
{
if(get_msg_arg_int(1) != 2)
{
return PLUGIN_CONTINUE;
}
new Float:gt = get_gametime() - gametime
new Float:rt = get_cvar_float("mp_roundtime") * 60.0

if (get_pcvar_num ( g_AutoJoin) == 1)
{
if(gt >= rt - 1.0)
{client_print(id, print_center, "Go to the game will be in the next round"); g_BlockTeam[id] = 1; idMSGid[id]=iMsgid;}
else
set_autojoin_task(id, iMsgid)
}
else
{
team_menu(id)
}

return PLUGIN_HANDLED;
}
public team_menu(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED

new Text[512]
formatex(Text, charsmax(Text), "%L", id, "MENU_NAME")
new menu = menu_create(Text, "menu_handler")

//1
if(cs_get_user_team(id) != CS_TEAM_T && g_BlockTeam[id] == 0)
formatex(Text, charsmax(Text), "%L", id, "MENU_TEAM_1", CountT)
else
formatex(Text, charsmax(Text), "\d%L", id, "MENU_TEAM_1_NO", CountT)
menu_additem(menu, Text, "1")

//2
if(!g_BlockTeam[id] && (float(CountT) / 4 > float(CountCT) || CountCT == 0))
formatex(Text, charsmax(Text), "%L", id, "MENU_TEAM_2", CountCT)

else
formatex(Text, charsmax(Text), "\d%L", id, "MENU_TEAM_2_NO", CountCT)
menu_additem(menu, Text, "2")

new bTeamSpect = (cs_get_user_team(id) == CS_TEAM_SPECTATOR)

if( bTeamSpect )
menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER)
else
menu_setprop(menu, MPROP_EXITNAME, "Выход")

menu_display(id, menu, 0)

return PLUGIN_HANDLED
}

public menu_handler(id, menu, item)
{
static restore, vgui, msgblock

new data[6], iName[64], access, callback

if(item == MENU_EXIT)
{
msgblock = get_msg_block(get_user_msgid("ShowMenu"))
set_msg_block(get_user_msgid("ShowMenu"), BLOCK_ONCE)
set_msg_block(96, msgblock)
set_pdata_int(id, 349, 1)
menu_destroy(menu)
return PLUGIN_HANDLED
}
restore = get_pdata_int(id, 510)
vgui = restore & (1<<0)

if(vgui)
set_pdata_int(id, 510, restore & ~(1<<0))

menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)

new key = str_to_num(data)

switch(key)
{
case 1:
{
if(g_BlockTeam[id] != 0)
return PLUGIN_HANDLED

if(cs_get_user_team(id) != CS_TEAM_T)
{
set_msg_block(96, BLOCK_ONCE)
engclient_cmd(id, "jointeam", "1")
engclient_cmd(id, "joinclass", "1")
set_msg_block(96, BLOCK_NOT)
g_BlockTeam[id] = 2
}
else client_print(id, print_center, "%L", id, "YOU_TEAM_T")
}
case 2:
{
if(g_BlockTeam[id] != 0)
return PLUGIN_HANDLED

if(!g_BlockTeam[id] && (float(CountT) / 4 > float(CountCT) || CountCT == 0))
{
if(cs_get_user_team(id) != CS_TEAM_CT)
{
set_msg_block(96, BLOCK_ONCE)
engclient_cmd(id, "jointeam", "2")
engclient_cmd(id, "joinclass", "2")
set_msg_block(96, BLOCK_NOT)
g_BlockTeam[id] = 2
}
else client_print(id, print_center, "%L", id, "YOU_TEAM_CT")
}
else ChatColor(id, "%L", id, "MENU_NO_TEAM_CT")
}
}
if(vgui) set_pdata_int(id, 510, restore)

return PLUGIN_HANDLED
}

public task_Autojoin(iParam[], id)
{
new iMsgBlock = get_msg_block(iParam[0]);
set_msg_block(iParam[0], BLOCK_SET);
engclient_cmd(id, "jointeam", "1")
engclient_cmd(id, "joinclass", "1")

set_msg_block(iParam[0], iMsgBlock);
}
public AlivePlayer()
{
CountT = 0
CountCT = 0

for(new id = 1; id <= get_maxplayers(); id++)
{
if(!is_user_connected(id))
continue

if(cs_get_user_team(id) == CS_TEAM_T)
CountT++
else if(cs_get_user_team(id) == CS_TEAM_CT)
CountCT++
}
}

public jointeam(id) return PLUGIN_HANDLED
public on_round_start()
{
gametime = get_gametime()

for(new id = 1; id <= get_maxplayers(); id++)
{
if(g_BlockTeam[id] >= 1) g_BlockTeam[id]--
if(get_user_team(id)==3) team_menu(id)
}

}

stock set_autojoin_task(id, iMsgid)
{
new iParam[2]
iParam[0] = iMsgid
set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam))
}

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")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")

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();
}
}
}
}


Отредактировал: Bloo, - 19.2.2015, 15:53
Причина: Выдано устное предупреждение!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: