搜索
查看: 2310|回复: 1

请问一个投票菜单制作

[复制链接]
发表于 2008-7-9 16:34:11 | 显示全部楼层 |阅读模式 来自 中国–广西–柳州–柳北区
public plugin_init() {
  new MenuName[64]
  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[64]
  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[id])
{
  g_restart_attempt[id] = false
  return PLUGIN_CONTINUE
}
set_task(3.0, "viewss", id)
return PLUGIN_CONTINUE
}


public viewss(id)
{
g_round++
if(g_round == 1)
{
   new menu[512],mkeys= (1<<7|1<<8|1<<9)
   new pos=format(menu,511,g_coloredMenus? "\y是否需要換圖:\w^n^n" : "是否需要換圖:^n^n")
   pos+=format(menu[pos],511-pos,"8.換新的地圖^n")
   pos+=format(menu[pos],511-pos,"9.繼續本地圖^n")
   pos+=format(menu[pos],511-pos,"^n0.棄權")
   for(new i=0;i<3;i++)g_voteYN=0//Reset Vote Map
   new MenuName[64]
   format(MenuName,63,"是否需要換圖")
   show_menu(0,mkeys,menu,15,MenuName)
   set_task(6.0,"checkYN")
}

public checkYN(){
new votemsg[129]
/*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[0]+g_voteYN[1]//选择换图与不换得总人数
new iRatio=votesNum?floatround(g_voteRatio * float( votesNum ) ,floatround_ceil) : 1//Need vote count
if(g_voteYN[0]>g_voteYN[1]){//购人了。
format(votemsg,128,"0x01投票通過,選擇下一地圖的投票將在0x0450x01秒後開始[選擇換地圖0x04%d0x01票,需要0x04%d0x01票]",g_voteYN[0],iRatio)
set_task(5.0,"voteNextmap")
}
else{
new mapname[32]
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都无任何影响。谢谢
发表于 2008-7-9 16:53:22 | 显示全部楼层 来自 中国–河北–保定

回复: 请问一个投票菜单制作

我想配合client_cmd来绑定按键来做比较容易。我比较无知,见笑了。
如果有兴趣我们交流交流QQ:54477714
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表