请前辈们进来帮我加下。投票地图里的声音功能1!
在下面地图投票里加下按键的声音效果:选择下幅地图语音提示:是的 ! 不同意:是的/* AMX Mod X
* Nextmap Chooser Plugin
*
* by the AMX Mod X Development Team
*originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*This program is free software; you can redistribute it and/or modify it
*under the terms of the GNU General Public License as published by the
*Free Software Foundation; either version 2 of the License, or (at
*your option) any later version.
*
*This program is distributed in the hope that it will be useful, but
*WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software Foundation,
*Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*In addition, as a special exception, the author gives permission to
*link the code of this program with the Half-Life Game Engine ("HL
*Engine") and Modified Game Libraries ("MODs") developed by Valve,
*L.L.C ("Valve"). You must obey the GNU General Public License in all
*respects for all of the code used other than the HL Engine and MODs
*from Valve. If you modify this file, you may extend this exception
*to your version of the file, but you are not obligated to do so. If
*you do not wish to do so, delete this exception statement from your
*version.
*/
#include <amxmodx>
#include <amxmisc>
#define MAX_MAPS 128
#define SELECTMAPS5
new g_voteforchange,g_voted_map
new g_mapName
new g_mapNums
new g_nextName
new g_voteCount
new g_mapVoteNum
new g_teamScore
new g_lastMap
new g_voteYN
new Float:g_ori_timelimit=0.0
new g_coloredMenus
new bool:g_selected = false
public plugin_init() {
register_plugin("Nextmap Chooser",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("mapchooser.txt")
register_dictionary("common.txt")
new MenuName
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
register_menucmd(register_menuid(MenuName),(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_concmd("amx_votechange","cmdVoteChange",ADMIN_VOTE,"- vote for change map")
register_cvar("amx_extendmap_max","90")
register_cvar("amx_extendmap_step","15")
//register_cvar("amx_in_voting","0")
//set_cvar_num("amx_in_voting",0)
if ( cstrike_running() )
register_event("TeamScore", "team_score", "a")
get_localinfo("lastMap",g_lastMap,31)
set_localinfo("lastMap","")
new maps_ini_file
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, 63)
if ( loadSettings(maps_ini_file) )
//set_task(15.0,"voteNextmap",987456,"",0,"b")
set_task(15.0,"voteShoudChange",987456,"",0,"b")
g_coloredMenus = colored_menus()
g_ori_timelimit=0.0
g_voteforchange=0
}
public change_map(){
server_cmd("changelevel %s",g_voted_map)
}
public checkVotes() {
new b = 0
for (new a = 0; a < g_mapVoteNum; ++a)
if (g_voteCount < g_voteCount)
b = a
/*if ( g_voteCount > g_voteCount ) {
new mapname
get_mapname(mapname,31)
new Float:steptime = get_cvar_float("amx_extendmap_step")
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
mapname , steptime )
return
}*/
//if ( g_voteCount && g_voteCount <= g_voteCount )
new nxtmapmsg
new smap
if(!g_voteforchange){
if ( g_voteCount) set_cvar_string("amx_nextmap", g_mapName] )
get_cvar_string("amx_nextmap",smap,31)
format(nxtmapmsg,128,"%L", LANG_SERVER, "CHO_FIN_NEXT", smap,g_voteCount )
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
//set_cvar_num("amx_in_voting",0)
}else{
g_voteforchange=0
format(nxtmapmsg,128,"%L", LANG_SERVER, "CHO_FIN_CHANGEMAP", g_mapName],g_voteCount)
copy(g_voted_map,32,g_mapName])
set_task(5.0,"change_map")
//set_cvar_num("amx_in_voting",1)
}
while(replace(nxtmapmsg,128,"0x01","^x01")){}
while(replace(nxtmapmsg,128,"0x02","^x02")){}
while(replace(nxtmapmsg,128,"0x03","^x03")){}
while(replace(nxtmapmsg,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(nxtmapmsg)
message_end()
break;
}
}
client_cmd(0,"spk events/tutor_msg")
//client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
}
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>=iRatio){//购人了。
format(votemsg,128,"%L",LANG_SERVER,"CHO_FIN_SUCESS",g_voteYN,iRatio)
set_task(5.0,"voteNextmap")
log_amx("Vote:Voting Sucess, We will start voting new map")
}
else{
format(votemsg,128,"%L",LANG_SERVER,"CHO_FIN_FAIL",g_voteYN,iRatio)
//set_cvar_num("amx_in_voting",0)//投票结束。
g_voteforchange=0
log_amx("Vote:Voteing Fail for Changing Map, Need:%d,Got:%d",iRatio,g_voteYN)
}
}else
{
if(g_voteYN>g_voteYN){//换图
format(votemsg,128,"%L",LANG_SERVER,"CHO_FIN_ANOTHER",g_voteYN)
log_amx("Vote: Voting for if changeing map finished, We will start another Vote.")
set_task(5.0,"voteNextmap")
}
else //继续延长
{
new mapname
get_mapname(mapname,31)
new Float:steptime = get_cvar_float("amx_extendmap_step")
if(g_ori_timelimit==0.0) g_ori_timelimit = get_cvar_float("mp_timelimit")
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
//set_cvar_num("amx_in_voting",0)
g_selected=false
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
mapname , steptime )
//client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
format(votemsg,128,"%L", LANG_SERVER, "CHO_FIN_EXT", steptime,g_voteYN )
}
}
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
}
public countYN(id,key){//Yes, Or No
if(get_cvar_float("amx_vote_answers")){
new choose,yes,no,disclaim
new name,votemsg=""
format(choose,20,"%L",id,"CHOOSE")
format(yes,20,"%L",id,"YES_MAP")
format(no,20,"%L",id,"NO_MAP")
format(disclaim,20,"%L",id,"DISCLAIM")
get_user_name(id,name,31)
//client_print(id,print_chat,"%s:%d",name,key)
if(key==9){
format(votemsg,128,"^x03%s^x01%s^x04%s",name,choose,disclaim)
}
else if(key==8){
format(votemsg,128,"^x03%s^x01%s^x04%s",name,choose,no)
}
else if(key==7){
format(votemsg,128,"^x03%s^x01%s^x04%s",name,choose,yes)
}
message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(votemsg)
message_end()
}
g_voteYN++
return PLUGIN_HANDLED
}
public countVote(id,key) {
if ( get_cvar_float("amx_vote_answers") ) {
new name,votemsg
get_user_name(id,name,31)
// if ( key == SELECTMAPS )
// format(votemsg,128,"%L", LANG_PLAYER, "CHOSE_EXT", name )
//client_print(0,print_chat,"%L", LANG_PLAYER, "CHOSE_EXT", name )
// else if ( key < SELECTMAPS )
format(votemsg,128,"%L", LANG_SERVER, "X_CHOSE_X", name, g_mapName] )
//client_print(0,print_chat,"%L", LANG_PLAYER, "X_CHOSE_X", name, g_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")){}
message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(votemsg)
message_end()
}
++g_voteCount
return PLUGIN_HANDLED
}
bool:isInMenu(id) {
for (new a=0; a<g_mapVoteNum; ++a)
if (id==g_nextName)
return true
return false
}
public cmdVoteChange(id,level,cid){
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()) {
console_print(id, "%L", id, "ALREADY_VOTING")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED
}
new timeleft=get_timeleft()
if(timeleft<=5){
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED
}
VoteChangeMap()
return PLUGIN_HANDLED
}
public VoteChangeMap(){
new timeleft = get_timeleft()
if(timeleft<3) return PLUGIN_HANDLED
if(g_selected) return PLUGIN_HANDLED
g_voteforchange=1//为改变地图投票
voteShoudChange()
return PLUGIN_HANDLED
}
public voteShoudChange(){
new winlimit=get_cvar_num("mp_winlimit")
new maxrounds = get_cvar_num("mp_maxrounds")
if(!g_voteforchange){
if ( winlimit ) {
new c = winlimit - 2
if ( (c > g_teamScore) && (c > g_teamScore) ) {
g_selected = false
return PLUGIN_HANDLED
}
}
elseif ( maxrounds ) {
if ( (maxrounds - 2) > (g_teamScore + g_teamScore) ){
g_selected = false
return PLUGIN_HANDLED
}
}
else {
new timeleft = get_timeleft()
if (timeleft<1||timeleft>129){
g_selected = false
return PLUGIN_HANDLED
}
}
if (g_selected) return PLUGIN_HANDLED
g_selected = true
}
//g_selected=false
//判断是否有其他的投票
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()) {
//console_print(id, "%L", id, "ALREADY_VOTING")
return PLUGIN_HANDLED
}
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting",get_gametime() + vote_time )
if (g_voteforchange||((winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))){//vote for Extended
new menu,mkeys= (1<<7|1<<8|1<<9)
new pos=format(menu,511,g_coloredMenus? "\y%L:\w^n^n" : "%L:^n^n",LANG_SERVER,"SHOULD_CHANGE_MAP")
pos+=format(menu,511-pos,"8.%L^n",LANG_SERVER,"YES_MAP")
pos+=format(menu,511-pos,"9.%L^n",LANG_SERVER,"NO_MAP")
pos+=format(menu,511-pos,"^n0.%L",LANG_SERVER,"DISCLAIM")
for(new i=0;i<3;i++)g_voteYN=0//Reset Vote Map
new MenuName
format(MenuName,63,"%L","en","SHOULD_CHANGE_MAP")
show_menu(0,mkeys,menu,15,MenuName)
set_task(15.0,"checkYN")
client_cmd(0,"spk Gman/Gman_Choose2")
log_amx("Vote: Voting for if Changeing map started")
}else
{
voteNextmap()
}
return PLUGIN_HANDLED
}
public voteNextmap() {
new menu, a, mkeys = 0
new mapname
new pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
new dmax = (g_mapNums-1 > SELECTMAPS) ? SELECTMAPS : g_mapNums-1
get_mapname(mapname,31)
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
a=random_num(0,g_mapNums-1)
for(;;){
if(isInMenu(a)||equal(g_mapName,mapname)) ++a
else break;
if(a>=g_mapNums) a=0
}
g_nextName = a
new showid=g_mapVoteNum+6
if (showid>9) showid=0
pos += format(menu,511-pos,"%d. %s^n",showid,g_mapName)//We Start From 6-0
mkeys |= (1<<g_mapVoteNum+5)
g_voteCount = 0
}
//menu='^n'
//g_voteCount = 0
//g_voteCount = 0
for(new i=dmax;i<SELECTMAPS;++i)g_voteCount=0//Clear Unused Maps
// new mapname
// get_mapname(mapname,31)
// if ( (winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))) {
// pos += format(menu,511,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTED_MAP",mapname)
// mkeys |= (1<<SELECTMAPS)
// }
// format(menu,511,"%d. %L",SELECTMAPS+2,LANG_SERVER,"NONE")
new MenuName
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
show_menu(0,mkeys,menu,15,MenuName)
set_task(15.0,"checkVotes")
client_print(0,print_chat,"%L",LANG_SERVER,"TIME_CHOOSE")
client_cmd(0,"spk Gman/Gman_Choose2")
log_amx("Vote: Voting for the nextmap started")
}
loadSettings(filename[]) {
if (!file_exists(filename)) return 0
new szText
new a, pos = 0
new currentMap
get_mapname(currentMap,31)
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) ) {
if ( szText != ';'
&&parse(szText, g_mapName ,31 )
&&is_map_valid( g_mapName )
&&!equali( g_mapName ,g_lastMap)
&&!equali( g_mapName ,currentMap) )
++g_mapNums
}
return g_mapNums
}
public team_score() {
new team
read_data(1,team,1)
g_teamScore[ (team=='C') ? 0 : 1 ] = read_data(2)
}
public plugin_end() {
new current_map
get_mapname(current_map,31 )
set_localinfo("lastMap",current_map)
if(g_ori_timelimit!=0.0) set_cvar_float("mp_timelimit", g_ori_timelimit)
}
回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
Post by wangyang5008在下面地图投票里加下按键的声音效果:选择下幅地图语音提示:是的 ! 不同意:是的
/* AMX Mod X
* Nextmap Chooser Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the G...
你都发了这么多同样主题的帖子,说实话,加这样的功能一点技术含量都没有。
我就给你一个吧。对应的文件放到对应的目录下去。
回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
我按照对应文件加了,怎么还是没有发出声音啊。声音文件是下载到客户端了,能不能把源码发上来或者提示我下,谢谢!我原来的那个投票插件是不是要关掉的,谢谢前辈再次帮助回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
Post by wangyang5008我按照对应文件加了,怎么还是没有发出声音啊。声音文件是下载到客户端了,能不能把源码发上来或者提示我下,谢谢!我原来的那个投票插件是不是要关掉的,谢谢前辈再次帮助
把你的mapchooser.amxx关掉。用mapchooser2.amxx
回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
OK ,我还是想知道具体加什么代码上去。因为我还有热门投票要加这样的效果。晚辈向前辈学习!回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
Cr@zyTreE 前辈请问下。,你这个插件:是改选择了,这个语音好像没有了。回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
这个文件是不是这样的gman/gman_choose2.wav的路径!回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
Post by wangyang5008这个文件是不是这样的gman/gman_choose2.wav的路径!
我的没问题。是这个。
回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
我原来的也是这样的,可是为什么他没有语音是改选择了!回复: 请前辈们进来帮我加下。投票地图里的声音功能1!
只有按键的声音了。没有提示:是改选择了!请你再帮忙看看!
页:
[1]
2