请问一个投票菜单制作
public plugin_init() {
new MenuName
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
register_menucmd(register_menuid(MenuName),(1<<4|1<<5|1<<6|1<<7|1<<8|1<<9),"countVote")//6-0
new YNMenuName
format(YNMenuName,63,"%L","en","SHOULD_CHANGE_MAP")
register_menucmd(register_menuid(YNMenuName),(1<<7|1<<8|1<<9),"countYN")//我们先提示是否换图
register_event("ResetHUD", "eResetHUD", "be")
}
public eResetHUD(id)
{
if (g_restart_attempt)
{
g_restart_attempt = false
return PLUGIN_CONTINUE
}
set_task(3.0, "viewss", id)
return PLUGIN_CONTINUE
}
public viewss(id)
{
g_round++
if(g_round == 1)
{
new menu,mkeys= (1<<7|1<<8|1<<9)
new pos=format(menu,511,g_coloredMenus? "\y是否需要換圖:\w^n^n" : "是否需要換圖:^n^n")
pos+=format(menu,511-pos,"8.換新的地圖^n")
pos+=format(menu,511-pos,"9.繼續本地圖^n")
pos+=format(menu,511-pos,"^n0.棄權")
for(new i=0;i<3;i++)g_voteYN=0//Reset Vote Map
new MenuName
format(MenuName,63,"是否需要換圖")
show_menu(0,mkeys,menu,15,MenuName)
set_task(6.0,"checkYN")
}
public checkYN(){
new votemsg
/*if(g_voteforchangemap){
new g_voteRatio = get_cvar_float("amx_votemap_ratio")
}*/
if(g_voteforchange){
new Float:g_voteRatio=get_cvar_float("amx_votemap_ratio")
new votesNum=g_voteYN+g_voteYN//选择换图与不换得总人数
new iRatio=votesNum?floatround(g_voteRatio * float( votesNum ) ,floatround_ceil) : 1//Need vote count
if(g_voteYN>g_voteYN){//购人了。
format(votemsg,128,"0x01投票通過,選擇下一地圖的投票將在0x0450x01秒後開始[選擇換地圖0x04%d0x01票,需要0x04%d0x01票]",g_voteYN,iRatio)
set_task(5.0,"voteNextmap")
}
else{
new mapname
get_mapname(mapname,31)
server_cmd("changelevel %s", mapname)
client_print(0,print_chat,"投票成功,服务器将重新加载%s",mapname)
}
}
while(replace(votemsg,128,"0x01","^x01")){}
while(replace(votemsg,128,"0x02","^x02")){}
while(replace(votemsg,128,"0x03","^x03")){}
while(replace(votemsg,128,"0x04","^x04")){}
new id=0
for(id=1;id<=32;id++){
if(is_user_connected(id)){
message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0}, 1)
write_byte(1)
write_string(votemsg)
message_end()
break;
}
}
client_cmd(0,"spk events/tutor_msg")
return
}请问这样为什么按8或9都无任何影响。谢谢
回复: 请问一个投票菜单制作
我想配合client_cmd来绑定按键来做比较容易。我比较无知,见笑了。如果有兴趣我们交流交流QQ:54477714
页:
[1]