Я хочу удалить vote bind F8 F9 key способ. Изменить vote на тип menu

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
1
Реакции
0
Неверный раздел форума
Ошибка
Я хочу удалить vote bind F8 F9 key способ. Изменить vote на тип menu
Компилятор
Локальный
Amx Mod X
1.9.0
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "MATCH: Vote"
#define VERSION "1.0"
#define AUTHOR "k1nader"
#define LOADING "^n^t%s v%s, Copyright (C) 2014 by %s^n"

#define VOTEID 20001

#define VOTEWAIT 240.0

native match_get_begin();
native match_get_team(client);
forward match_end(WinTeam, TR_Score, CT_Score);

new m_iMenu = 205;
new g_SayText;
new g_iVote = 0;
new g_VoteMessage[512];
new g_messageShowCount = 0;
new gVotes[2];
new choose[33];
new Float:g_fVoteTime[33];

new g_szMap[][] = {"de_dust2", "de_inferno", "de_nuke", "de_train", "de_tuscan", "de_forge", "de_mirage", "cs_bloodstrike"}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
server_print(LOADING, PLUGIN, VERSION, AUTHOR);
set_task(60.0, "VoteShowHit", _,_,_, "b");

g_SayText = get_user_msgid("SayText");
// Add your code here...

gVotes[0] = 0;
gVotes[1] = 0;

register_clcmd("cl_votekick", "VoteKickPlayer");
register_clcmd("cl_votemap", "VoteMapPlayer");
register_clcmd("cl_vote_no", "VoteNo");
register_clcmd("cl_vote_yes", "VoteYes");

InitChoose();
}

public client_connect(id)
{
choose[id] = 0;
g_fVoteTime[id] = 0.0;
}

public VoteNo(id)
{
if (g_iVote)
{
if (0 < match_get_team(id))
{
if (!choose[id])
{
choose[id] = 1;
gVotes[1]++;
new name[32];
get_user_name(id, name, charsmax(name));

client_color(0, id, "^3%s ^1选择了^4 反对", name);
}
}
}
return PLUGIN_HANDLED;
}

public VoteYes(id)
{
if (g_iVote)
{
if (0 < match_get_team(id))
{
if (!choose[id])
{
choose[id] = 1;
gVotes[0]++;
new name[32];
get_user_name(id, name, charsmax(name));

client_color(0, id, "^3%s ^1选择了^4 同意", name);
}
}
}
return PLUGIN_HANDLED;
}

public InitChoose()
{
for (new i = 0; i < 33; i++)
choose[i] = 0;
}

public VoteShowHit()
{
if (!match_get_begin())
{
client_color(0, 0, "提示:可以使用 ^4say !vp ^1投票踢出某个玩家。");
client_color(0, 0, "提示:可以使用 ^4say !vm ^1投票更换地图。");
}
}

public VoteKickPlayer(id)
{
new menu = menu_create("投票踢出玩家", "kick_menu_handler");

new szName[32], szTempid[10];

for(new i = 1; i < get_maxplayers(); i++)
{
if (is_user_connected(i))
{
get_user_name(i, szName, charsmax(szName));
num_to_str(i, szTempid, charsmax(szTempid));
menu_additem(menu, szName, szTempid);
}
}
menu_setprop(menu, MPROP_BACKNAME, "上一页");
menu_setprop(menu, MPROP_NEXTNAME, "下一页");
menu_setprop(menu, MPROP_EXITNAME, "退出");

set_pdata_int(id, m_iMenu, 0);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}

public kick_menu_handler(id, menu, item)
{
if(item == MENU_EXIT )
{
menu_destroy(menu);
return;
}

if ((get_gametime() - g_fVoteTime[id]) <= VOTEWAIT)
{
client_color(id, id, "发起投票间隔必须大于^4 %.1f ^1秒。", VOTEWAIT);
return;
}

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

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

new tempid = str_to_num(data);

KickVotemenu(id, tempid);

menu_destroy(menu);

}

public KickVotemenu(id, tempid)
{
if(g_iVote)
{
client_color(id, id, "已经有一个投票在进行中,现在禁止投票。");
return;
}

g_fVoteTime[id] = get_gametime();

g_iVote = 1;

new Name[32];
get_user_name(tempid, Name, charsmax(Name));

formatex(g_VoteMessage, charsmax(g_VoteMessage), "是否同意踢出 %s ?^n^n【F8】同意^n【F9】反对", Name);

g_messageShowCount = 20;
set_task(1.0, "ShowVoteMessage", VOTEID + tempid, _, _, "a", 21);
set_task(21.0, "EndKickVote", tempid);
}

public ShowVoteMessage(taskid)
{
new tempid = taskid - VOTEID;

if (g_messageShowCount < 1)
remove_task(taskid);

new onshow;

for (new i = 1; i < get_maxplayers(); i++)
{
if (g_iVote == 1)
onshow = tempid != i;
else
onshow = 1;

if (is_user_connected(i) && 0 < match_get_team(i) < 3 && onshow && !choose[i] && g_iVote)
{
client_cmd(i, "bind F8 cl_vote_yes;bind F9 cl_vote_no");
ShowDirectorMessage(i, 0.05, 0.4, 255, 255, 255, 0, 0.01, 0.01, 1.0, 1.0, g_VoteMessage);
}
}

g_messageShowCount--;
}

stock ShowDirectorMessage(id, Float:x, Float:y, r, g, b, effect, Float:fadeintime, Float:fadeouttime, Float:holdtime, Float:fxtime, const msg[], {Float, Sql, Result, _}:...)
{
new text[128];
vformat(text, 127, msg, 13);
new len = strlen(text);
if(!len) return;

if(id)
message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, id);
else
message_begin(MSG_BROADCAST, SVC_DIRECTOR, _, 0);

write_byte(31+len); // command length
write_byte(DRC_CMD_MESSAGE); // command_event
write_byte(effect); // effect
write_byte(b); // b
write_byte(g); // g
write_byte(r); // r
write_byte(0); // a
write_long(_:x); // x
write_long(_:y); // y
write_long(_:fadeintime); // fade in time
write_long(_:fadeouttime); // fade out time
write_long(_:holdtime); // hold time
write_long(_:fxtime); // [optional] effect time - time the highlight lags behing the leading text in effect 2
write_string(text); // string text message
message_end();
}


public EndKickVote(tempid)
{
if (is_user_connected(tempid))
{
new Name[32];
get_user_name(tempid, Name, charsmax(Name));

if (float(gVotes[0]) < (float(get_player_nums(tempid)) / 2.0) + 1.0)
client_color(0, 0, "投票失败(需要至少一半人以上同意): 同意^4 %d ^1票,反对^4 %d ^1票。", gVotes[0], gVotes[1]);
else
{
client_color(0, 0, "投票成功(^3%s^1将被踢出服务器): 同意^4 %d ^1票,反对^4 %d ^1票。", Name, gVotes[0], gVotes[1]);
server_cmd( "kick #%d ^"你已经被玩家投票踢出^"", get_user_userid(tempid));
}
}
gVotes[0] = 0;
gVotes[1] = 0;
g_iVote = 0;

InitChoose();
}

public VoteMapPlayer(id)
{
if (match_get_begin())
{
if (!canchange())
{
client_color(id, id, "比赛已经开始,不能投票换图。");
return PLUGIN_HANDLED;
}
}

set_pdata_int(id, m_iMenu, 0);

new menu = menu_create("投票更换地图", "Map_menu_handler");

new szTempid[10];

for(new i = 0; i < sizeof(g_szMap); i++)
{
num_to_str(i, szTempid, charsmax(szTempid));
menu_additem(menu, g_szMap[i], szTempid);
}
menu_setprop(menu, MPROP_BACKNAME, "上一页");
menu_setprop(menu, MPROP_NEXTNAME, "下一页");
menu_setprop(menu, MPROP_EXITNAME, "退出");

menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}

public Map_menu_handler(id, menu, item)
{
if(item == MENU_EXIT )
{
menu_destroy(menu);
return;
}

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

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

new tempid = str_to_num(data);

MapVotemenu(id, tempid);

menu_destroy(menu);
}

public MapVotemenu(id, tempid)
{
if(g_iVote)
{
client_color(id, id, "已经有一个投票在进行中,现在禁止投票。");
return;
}

g_iVote = 2;

formatex(g_VoteMessage, charsmax(g_VoteMessage), "是否同意更换地图为 %s ?^n^n【F8】同意^n【F9】反对", g_szMap[tempid]);

g_messageShowCount = 20;
set_task(1.0, "ShowVoteMessage", VOTEID + tempid, _, _, "a", 21);
set_task(21.0, "EndMapVote", tempid);
}


public EndMapVote(tempid)
{
if (match_get_begin())
{
if (!canchange())
{
gVotes[0] = 0;
gVotes[1] = 0;
g_iVote = 0;

InitChoose();
client_color(0, 0, "比赛已经开始,投票被结果作废。");
return;
}
}

if (float(gVotes[0]) < (float(get_player_nums(0)) / 2.0) + 0.5)
client_color(0, 0, "投票失败(需要至少一半人以上同意): 同意^4 %d ^1票,反对^4 %d ^1票。", gVotes[0], gVotes[1]);
else
{

client_color(0, 0, "投票成功(^3地图5秒后将更换为^4 %s^1): 同意^4 %d ^1票,反对^4 %d ^1票。", g_szMap[tempid], gVotes[0], gVotes[1]);
set_task(5.0, "DelayLock", tempid);
ShowBarTime(5);
}

gVotes[0] = 0;
gVotes[1] = 0;
g_iVote = 0;

InitChoose();
}

public match_end(WinTeam, TR_Score, CT_Score)
{
new index = get_next_map();
client_color(0, 0, "服务器将在一分钟后更换地图为^4 %s", g_szMap[index]);
set_task(55.0, "changemap", index);
}

public changemap(taskid)
{
set_task(5.0, "DelayLock", taskid);
ShowBarTime(5);
}

public DelayLock(taskid)
{
LockAllUser();
set_task(2.0, "changelevelmap", taskid);
}

public changelevelmap(tempid)
server_cmd("changelevel %s", g_szMap[tempid]);

public get_player_nums(id)
{
new count = 0;

for (new i = 1; i < get_maxplayers(); i++)
{
if (is_user_connected(i))
{
if (!is_user_bot(i) && !is_user_hltv(i) && id != i && (0 < match_get_team(i) < 3))
count++;
}
}

return count;
}

public canchange()
{
new mapname[32];
get_mapname(mapname, charsmax(mapname));
return (equal(mapname, "cs_bloodstrike"));
}

public ShowBarTime(iTime)
{
message_begin(MSG_BROADCAST, get_user_msgid("BarTime"), _, _);
write_short(iTime);
message_end();
}

public LockAllUser()
{
message_begin(MSG_BROADCAST, SVC_INTERMISSION);
message_end();
}

public get_next_map()
{
new mapname[32], mapindex;

get_mapname(mapname, charsmax(mapname));
if (equal(mapname, "de_mirage"))
mapindex = 0;
else if (equal(mapname, "cs_bloodstrike"))
mapindex = 0;
else
{
for (new i = 0; i < sizeof(g_szMap); i++)
{
if (equal(mapname, g_szMap[i]))
mapindex = i + 1;
}
}
return mapindex;
}

stock client_color(index, color, const msg[], any:...)
{
static szMessage[256], len;

len = formatex(szMessage, charsmax(szMessage), "^4【Server】^1");

vformat(szMessage[len], charsmax(szMessage) - len, msg, 4);

message_begin(index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_SayText, _, index);
write_byte(color ? color : print_chat);
write_string(szMessage);
message_end();

client_print(index, print_console, szMessage);
}
Помогите добрые люди.

Я хочу удалить vote bind F8 F9 key способ. Изменить vote на тип menu

как исправить?

Заранее благодарю за любую помощь, которую вы можете оказать.
 
Сообщения
197
Реакции
16
Помог
1 раз(а)
zeroking, вам лучше установить другой мапменеджер, на котором нет биндов и голосования проходят с помощью меню, например этот. иначе следуйте в заказы.
 
Сообщения
2,491
Реакции
2,791
Помог
61 раз(а)
zeroking, вам в раздел вопросов модификации или заказов. Этот раздел проблем с компилированием. Закрыто.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу