/* AMX Mod script. * * (c) 2003, OLO * This file is provided as is (no warranties). * * Adapted for MS:C by Thothie * Changes: * Global client commands: votemap [mapname] Example: votemap edana * Works from console or chat, players can start votes for one map only * Players may only vote for adjacent maps, root towns, or pre-defined custom maps * - Some hacks involved here, having problems echoing string vars to chat/console. * CVARS[defalts] * custommaps["ww1 unrest pvp_archery pvp_arena"] - List of available custom maps * LIMITATIONS: Custom maps with partially matched names may cause voting issues. * amx_votemap_ratio[0.40] % of voting players that need to vote yes for new map. * amx_vote_time[10] seconds before vote tallying ends * amx_vote_time[60] seconds between votes * amx_vote_answers[1] set to 0 to make voting anonymous * * This vote system will not work with other mods (or even MS 1.35) due to the menu number reversal * * These other commands require ADMIN_VOTE access (level j) and have not been changed: * amx_votekick Example: amx_votekick "Player" * amx_voteban Example: amx_voteban "Player" * amx_vote < question > < g_Answer1 > < g_Answer2 > * Examples: * amx_vote "sv_restart" "5" "0" * amx_vote "mp_timelimit" "20" "45" * amx_vote "are you hungry?" "yes" "no" * * TO INSTALL: * copy to msc/addons/amx/plugins - overwrite existing file. * make sure that adminvote.amx is enabled in your msc/addons/amx/config/plugins.ini * */ #include #include #include //globals added by Thothie new g_customMaps[512]; new g_rootTowns[] = "edana deralia helena"; new g_adjacentMaps[256]; new g_maxplayers; new g_votedFromChat; new g_passCommand[256]; //part of changelevel delay hack //originals new g_Answer[128] new g_optionName[4][32] new g_voteCount[4] new g_validMaps new g_yesNoVote new g_logFile[16] new g_cstrikeRunning new g_voteCaller new g_Execute[256] new g_execLen new g_alredyVoting[]= "There is already a vote in progress..." new g_notAllowed[] = "Too soon to start another vote..." new g_votingStarted[] = "Voting has started..." new g_playerTag[] = "PLAYER" new g_adminTag[] = "ADMIN" new bool:g_execResult new Float:g_voteRatio public plugin_init() { load_translations("adminvote") register_plugin("Beta MSC Adminvote","1.17","mods by Thothie") register_menucmd(register_menuid("Change map to ") ,(1<<0)|(1<<1),"voteCount") register_menucmd(register_menuid("Choose map: ") ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"voteCount") register_menucmd(register_menuid("Kick "),(1<<0)|(1<<1),"voteCount") register_menucmd(register_menuid("Ban "),(1<<0)|(1<<1),"voteCount") register_menucmd(register_menuid("Vote: ") ,(1<<0)|(1<<1),"voteCount") register_menucmd(register_menuid("The result: ") ,(1<<0)|(1<<1),"actionResult") register_concmd("votemap","cmdVoteMap",0," must be adjacent or root town") register_concmd("VOTEMAP","cmdVoteMap",0," must be adjacent or root town") register_concmd("Votemap","cmdVoteMap",0," must be adjacent or root town") register_concmd("amx_votekick","cmdVoteKickBan",ADMIN_VOTE,_T("")) register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,_T("")) register_concmd("amx_vote","cmdVote",ADMIN_VOTE,_T(" ")) register_concmd("amx_cancelvote","cmdCancelVote",ADMIN_VOTE,_T("- cancels last vote")) register_srvcmd("dochangelevel","cmdChangeLevel") register_cvar("amx_votekick_ratio","0.40") register_cvar("amx_voteban_ratio","0.40") register_cvar("amx_votemap_ratio","0.40") register_cvar("amx_vote_ratio","0.02") register_cvar("amx_vote_time","10") register_cvar("amx_vote_answers","1") register_cvar("amx_vote_delay","60") register_cvar("amx_last_voting","0") set_cvar_float("amx_last_voting",0.0) register_cvar("amx_show_activity","2") g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) get_logfile(g_logFile,15) //Thothie g_maxplayers = get_maxplayers(); register_clcmd("say_text","vote_check") register_cvar("custommaps","ww1 unrest pvp_archery pvp_arena") } public cmdCancelVote(id,level,cid){ if (!cmd_access(id,level,cid,0)) return PLUGIN_HANDLED if ( task_exists( 99889988 , 1 ) ) { new authid[32],name[32] get_user_authid(id,authid,31) get_user_name(id,name,31) log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" cancel vote session",name,get_user_userid(id),authid) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,_T("%s %s: cancel vote"), (get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag), name) case 1: client_print(0,print_chat,_T("%s: cancel vote"), (get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag)) } console_print(id, _T("Voting canceled") ) client_print(0,print_chat,_T("Voting canceled")) remove_task( 99889988, 1 ) set_cvar_float( "amx_last_voting" , get_gametime() ) } else console_print(id, _T("There is no voting to cancel or the vote session can't be canceled with that command") ) return PLUGIN_HANDLED } public delayedExec(cmd[]) server_cmd(cmd) new g_resultRef[] = "Result refused" new g_resultAcpt[] = "Result accepted" new g_votingFailed[] = "Voting failed" new g_votingSuccess[] = "Voting successful" public autoRefuse(){ log_to_file(g_logFile,"Vote: %s" , g_resultRef) client_print(0,print_chat,_T(g_resultRef) ) } public actionResult(id,key) { remove_task( 4545454 ) switch(key){ case 0:{ set_task(2.0,"delayedExec",0,g_Execute,g_execLen) log_to_file(g_logFile,"Vote: %s",g_resultAcpt) client_print(0,print_chat,_T(g_resultAcpt) ) } case 1: autoRefuse() } return PLUGIN_HANDLED } public checkVotes() { new best = 0 if ( !g_yesNoVote ) { for(new a = 0; a < 4; ++a) if (g_voteCount[a] > g_voteCount[best]) best = a } new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3] new iRatio = votesNum ? floatround( g_voteRatio * float( votesNum ) ,floatround_ceil) : 1 new iResult = g_voteCount[best] if ( iResult < iRatio ){ if (g_yesNoVote) client_print(0,print_chat,_T("%s (yes ^"%d^") (no ^"%d^") (needed ^"%d^")"),_T(g_votingFailed), g_voteCount[0], g_voteCount[1] , iRatio ) else client_print(0,print_chat,_T("%s (got ^"%d^") (needed ^"%d^")"),_T(g_votingFailed),iResult , iRatio ) log_to_file(g_logFile,"Vote: %s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio ) return PLUGIN_CONTINUE } g_execLen = format(g_Execute,255,g_Answer,g_optionName[best]) + 1 if (g_execResult) { if ( is_user_connected(g_voteCaller) ) { g_execResult = false set_task(2.0,"delayedExec",0,g_Execute,g_execLen) } } // Thothie attempting to remove stupid confirmation // if ( is_user_connected(g_voteCaller) ) { // new menuBody[512] // new len = format(menuBody,511,g_cstrikeRunning ? _T("\yThe result: \w%s^n^n",g_voteCaller) : _T("The result: %s^n^n",g_voteCaller), g_Execute ) // // len += copy( menuBody[len] ,511 - len, g_cstrikeRunning ? _T("\yDo you want to continue?^n\w",g_voteCaller) : _T("Do you want to continue?^n",g_voteCaller) ) // // copy( menuBody[len] ,511 - len, _T("^n1. No^n2. Yes",g_voteCaller)) // // show_menu( g_voteCaller ,0x03 ,menuBody, 10, "The result: ") // // set_task(10.0,"autoRefuse",4545454) // } // else // set_task(2.0,"delayedExec",0,g_Execute,g_execLen) client_print(0,print_chat,_T("%s (got ^"%d^") (needed ^"%d^"). The result: %s"), _T(g_votingSuccess), iResult , iRatio , g_Execute ) log_to_file(g_logFile,"Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", g_votingSuccess, iResult , iRatio , g_Execute ) return PLUGIN_CONTINUE } public voteCount(id,key){ if ( get_cvar_num("amx_vote_answers") ) { new name[32] get_user_name(id,name,31) if (g_yesNoVote) client_print(0,print_chat,_T("%s voted %s"),name,key ? _T("against") : _T("for") ) else client_print(0,print_chat,_T("%s voted for option #%d"),name,key+1) } ++g_voteCount[key] return PLUGIN_HANDLED } public cmdVote(id,level,cid) { if (!cmd_access(id,level,cid,4)) return PLUGIN_HANDLED new Float:voting = get_cvar_float("amx_last_voting") if (voting > get_gametime()){ console_print(id, g_alredyVoting) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_alredyVoting) return PLUGIN_HANDLED } if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) { console_print(id, g_notAllowed ) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_notAllowed) return PLUGIN_HANDLED } new quest[48] read_argv(1,quest,47) if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)|| (contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1)){ console_print(id,_T("Voting for that has been forbidden")) return PLUGIN_HANDLED } read_argv(2,g_optionName[0],31) read_argv(3,g_optionName[1],31) new authid[32],name[32] get_user_authid(id,authid,31) get_user_name(id,name,31) log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")",name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1]) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,_T("%s %s: vote custom"),(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag),name ) case 1: client_print(0,print_chat,_T("%s: vote custom"),(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag)) } new menu_msg[256] new keys = (1<<0)|(1<<1) new players[32] new numplayers new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 get_players(players,numplayers,"c") for(numplayers--;numplayers>=0;numplayers--){ format(menu_msg,255, g_cstrikeRunning ? _T("\yVote: %s\w^n^n1. %s^n2. %s", players[numplayers]) : _T("Vote: %s^n^n1. %s^n2. %s", players[numplayers]),quest,g_optionName[0],g_optionName[1]) show_menu(players[numplayers],keys,menu_msg,floatround(vote_time),"Vote: ") } g_execResult = false set_cvar_float("amx_last_voting", get_gametime() + vote_time ) g_voteRatio = get_cvar_float("amx_vote_ratio") format(g_Answer,127,"%s - %%s",quest) set_task(vote_time,"checkVotes" , 99889988 ) g_voteCaller = id console_print(id, _T(g_votingStarted) ) g_voteCount ={ 0,0,0,0} g_yesNoVote = 0 return PLUGIN_HANDLED } public cmdVoteKickBan(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED new Float:voting = get_cvar_float("amx_last_voting") if (voting > get_gametime()){ console_print(id, g_alredyVoting) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_alredyVoting) return PLUGIN_HANDLED } if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) { console_print(id, g_notAllowed ) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_notAllowed) return PLUGIN_HANDLED } new cmd[32] read_argv(0,cmd,31) new voteban = equal(cmd,"amx_voteban") new arg[32] read_argv(1,arg,31) new player = cmd_target(id,arg,1) if (!player) return PLUGIN_HANDLED if (voteban && is_user_bot(player)) { new imname[32] get_user_name(player,imname,31) console_print(id,_T("That action can't be performed on bot ^"%s^""),imname) return PLUGIN_HANDLED } new keys = (1<<0)|(1<<1) new menu_msg[256] new players[32] new numplayers new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 get_user_name(player,arg,31) get_players(players,numplayers) for(numplayers--;numplayers>=0;numplayers--){ format(menu_msg,255,g_cstrikeRunning ? _T("\y%s %s?\w^n^n1. Yes^n2. No", players[numplayers]) : _T("%s %s?^n^n1. Yes^n2. No", players[numplayers]), voteban ? _T("Ban", players[numplayers]) : _T("Kick", players[numplayers]), arg) show_menu(players[numplayers],keys,menu_msg,floatround(vote_time),voteban?"Ban ":"Kick ") } g_yesNoVote = 1 if (voteban) get_user_authid(player,g_optionName[0],31) else numtostr(get_user_userid(player),g_optionName[0],31) new authid[32],name[32] get_user_authid(id,authid,31) get_user_name(id,name,31) log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,_T("%s %s: vote %s for %s"),(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag),name,voteban ? "ban" : "kick",arg ) case 1: client_print(0,print_chat,_T("%s: vote %s for %s"),(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag),voteban ? "ban" : "kick",arg) } g_execResult = true set_cvar_float("amx_last_voting", get_gametime() + vote_time ) g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio") g_Answer = voteban ? "banid 30.0 %s kick" : "kick #%s" set_task(vote_time,"checkVotes" , 99889988 ) g_voteCaller = id console_print(id, _T(g_votingStarted) ) g_voteCount = {0,0,0,0} return PLUGIN_HANDLED } public cmdChangeLevel() { //force all players to delay reconnect to prevent map crash for ( new iPlayer = 1; iPlayer <= g_maxplayers; iPlayer++ ) { if ( is_user_connected(iPlayer) ) { client_cmd(iPlayer," alias waiter1 ^"wait;wait;wait;wait;wait;wait;wait;wait;wait;wait^""); client_cmd(iPlayer, "wait") client_cmd(iPlayer, " alias tenwaiter ^"waiter1;waiter1;waiter1;waiter1;waiter1;waiter1;waiter1;waiter1;waiter1;waiter1^""); client_cmd(iPlayer, "wait") client_cmd(iPlayer, " alias delayrec ^"disconnect;toggleconsole;tenwaiter;tenwaiter;tenwaiter;tenwaiter;echo Reconnecting...;retry^""); client_cmd(iPlayer, "wait") //client_cmd(iPlayer, "echo DEBUG: ^"quote test^" XD"); client_cmd(iPlayer, "clear;wait;echo MAPCHANGE: YOU WILL BE RECONNECTED SHORTLY... PLEASE WAIT!"); client_cmd(iPlayer, "wait") client_cmd(iPlayer, "delayrec"); } } new nextmap[32] read_argv(1, nextmap, 31) //message_begin(MSG_ALL, SVC_INTERMISSION) //message_end() //write next map to crashed.cfg, in case transition fails new recCommand[33]; format(recCommand, 32, "map %s", nextmap); write_file("crashed.cfg",recCommand,0); server_cmd ("echo VOTEMAP: Wrote to crashed.cfg: %s", recCommand) //delay to give time for aliases to get to players g_passCommand = nextmap set_task(1.0, "secondphase") } //thothie public secondphase() { //getting tired, nothing but hacks now :D //this seemed the only way to add a delay to changelevel safely and still pass string server_cmd("changelevel %s", g_passCommand) } //thothie public displayAdjacent_console(id) { //I really shouldn't have to do this (hack) //but for the life of me I can't get a dynamic global string echo to chat or console new map[33]; get_mapname(map, 32); if ( contain(map,"calruin") > -1 ) { client_print(id, print_console, "Adjacent Areas: sfor"); } if ( contain(map,"challs") > -1 ) { client_print(id, print_console, "Adjacent Areas: sfor"); } if ( contain(map,"daragoth") > -1 ) { client_print(id, print_console, "Adjacent Areas: helena deralia mines"); } if ( contain(map,"deralia") > -1 ) { client_print(id, print_console, "Adjacent Areas: daragoth"); } //this is to deal with duplicate name if ( contain(map,"edana") > -1 ) { if ( contain(map,"edanasewers") > -1 ) { client_print(id, print_console, "Adjacent Areas: edana"); } else { client_print(id, print_console, "Adjacent Areas: thornlands edanasewers"); } } if ( contain(map,"gatecity") > -1 ) { client_print(id, print_console, "Adjacent Areas: mscave"); } if ( contain(map,"goblintown") > -1 ) { client_print(id, print_console, "Adjacent Areas: mscave"); } if ( contain(map,"helena") > -1 ) { client_print(id, print_console, "Adjacent Areas: thornlands daragoth keledrosprelude2"); } if ( contain(map,"heras") > -1 ) { client_print(id, print_console, "Adjacent Areas: thornlands"); } if ( contain(map,"keledrosprelude2") > -1 ) { client_print(id, print_console, "Adjacent Areas: helena [bossmap]"); } if ( contain(map,"keledrosprelude2") > -1 ) { client_print(id, print_console, "Adjacent Areas: keledrosprelude2"); } if ( contain(map,"mines") > -1 ) { client_print(id, print_console, "Adjacent Areas: daragoth"); } if ( contain(map,"mscave") > -1 ) { client_print(id, print_console, "Adjacent Areas: gatecity goblintown thornlands"); } if ( contain(map,"sfor") > -1 ) { client_print(id, print_console, "Adjacent Areas: calruin [hiddenmap] thornlands"); } if ( contain(map,"thornlands") > -1 ) { client_print(id, print_console, "Adjacent Areas: heras helena sfor mscave edana"); } } //thothie public displayAdjacent_chat(id) { //I really shouldn't have to do this (hack) //but for the life of me I can't get a dynamic global string echo to chat or console new map[33]; get_mapname(map, 32); if ( contain(map,"calruin") > -1 ) { client_print(id, print_chat, "Adjacent Areas: sfor"); } if ( contain(map,"challs") > -1 ) { client_print(id, print_chat, "Adjacent Areas: sfor"); } if ( contain(map,"daragoth") > -1 ) { client_print(id, print_chat, "Adjacent Areas: helena deralia mines"); } if ( contain(map,"deralia") > -1 ) { client_print(id, print_chat, "Adjacent Areas: daragoth"); } //this is to deal with duplicate name if ( contain(map,"edana") > -1 ) { if ( contain(map,"edanasewers") > -1 ) { client_print(id, print_chat, "Adjacent Areas: edana"); } else { client_print(id, print_chat, "Adjacent Areas: thornlands edanasewers"); } } if ( contain(map,"gatecity") > -1 ) { client_print(id, print_chat, "Adjacent Areas: mscave"); } if ( contain(map,"goblintown") > -1 ) { client_print(id, print_chat, "Adjacent Areas: mscave"); } if ( contain(map,"helena") > -1 ) { client_print(id, print_chat, "Adjacent Areas: thornlands daragoth keledrosprelude2"); } if ( contain(map,"heras") > -1 ) { client_print(id, print_chat, "Adjacent Areas: thornlands"); } if ( contain(map,"keledrosprelude2") > -1 ) { client_print(id, print_chat, "Adjacent Areas: helena [bossmap]"); } if ( contain(map,"keledrosruins") > -1 ) { client_print(id, print_chat, "Adjacent Areas: keledrosprelude2"); } if ( contain(map,"mines") > -1 ) { client_print(id, print_chat, "Adjacent Areas: daragoth"); } if ( contain(map,"mscave") > -1 ) { client_print(id, print_chat, "Adjacent Areas: gatecity goblintown thornlands"); } if ( contain(map,"sfor") > -1 ) { client_print(id, print_chat, "Adjacent Areas: calruin [hiddenmap] thornlands"); } if ( contain(map,"thornlands") > -1 ) { client_print(id, print_chat, "Adjacent Areas: heras helena sfor mscave edana"); } } //thothie public listMaps(id) { get_cvar_string ("custommaps",g_customMaps,512) client_print(id, print_console, "Format is votemap [mapname], example: votemap edana"); if ( g_votedFromChat == 1 ) client_print(id, print_chat, "Format is votemap [mapname], example: votemap edana"); client_print(id, print_console, "You may vote for the following maps:"); if ( g_votedFromChat == 1 ) client_print(id, print_chat, "You may vote for the following maps:"); //these two won't work - hacked solution in above two hack functions //client_print(id, print_console, "Adjacent Maps: %s", g_adjacentMaps); //client_print(id, print_chat, "Adjacent Maps: %s", g_adjacentMaps); if ( g_votedFromChat == 1 ) displayAdjacent_chat(id); displayAdjacent_console(id); client_print(id, print_console, "Root Towns: %s", g_rootTowns); if ( g_votedFromChat == 1 ) client_print(id, print_chat, "Root Towns: %s", g_rootTowns); client_print(id, print_console, "Custom Maps (fast downloads): %s", g_customMaps); if ( g_votedFromChat == 1 ) client_print(id, print_chat, "Custom Maps (fast downloads): %s", g_customMaps); g_votedFromChat = 0 } public cmdVoteMap(id,level,cid) { //Thothie - lots of minor edits in here get_cvar_string ("custommaps",g_customMaps,512) new Float:voting = get_cvar_float("amx_last_voting") if ( voting > get_gametime() ) { console_print(id, _T(g_alredyVoting)) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_alredyVoting) return PLUGIN_HANDLED } if ( voting && voting + get_cvar_float("amx_vote_delay") > get_gametime() ) { console_print(id, g_notAllowed ) if ( g_votedFromChat == 1 ) client_print(id,print_chat,g_notAllowed) return PLUGIN_HANDLED } new argc = read_argc() if (argc > 5) argc = 5 g_validMaps = 0 g_optionName[0][0] = g_optionName[1][0] = g_optionName[2][0] = g_optionName[3][0] = 0 for(new i = 1; i < argc; ++i){ read_argv(i,g_optionName[g_validMaps],31) if (is_map_valid(g_optionName[g_validMaps])) { g_optionName[0]=g_optionName[g_validMaps] g_validMaps++; } } if ( is_map_valid(g_optionName[0]) ) g_validMaps = 1; //Thothie - Check for map legality if ( g_validMaps ==1 ) getLegalMaps( g_optionName[0] ); if (g_validMaps == 0) { //console_print(id,(argc==2)?_T("Given map is not valid"):_T("Given maps are not valid")) listMaps(id) return PLUGIN_HANDLED } new menu_msg[256] new keys = 0 new players[32] new numplayers new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 get_players(players,numplayers,"c") for(numplayers--;numplayers>=0;numplayers--){ format(menu_msg,255,"^n^n ^n^n^n^nChange map to %s?^n^n1. Exit Menu^n2. Yes^n3. No", g_optionName[0]) keys = (1<<0)|(1<<1)|(1<<2) g_yesNoVote = 1 show_menu(players[numplayers],keys,menu_msg,floatround(vote_time),"Change map to ") } new authid[32],name[32] get_user_authid(id,authid,31) get_user_name(id,name,31) log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name,get_user_userid(id),authid,g_optionName[0]) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,_T("%s %s: vote map(s)"),name,(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag)) case 1: client_print(0,print_chat,_T("%s: vote map(s)"),(get_user_flags(id) & ADMIN_USER) ? _T(g_playerTag) : _T(g_adminTag)) } g_execResult = true set_cvar_float("amx_last_voting", get_gametime() + vote_time ) g_voteRatio = get_cvar_float("amx_votemap_ratio") g_Answer = "dochangelevel %s" set_task(vote_time,"checkVotes" , 99889988 ) g_voteCaller = id console_print(id, _T(g_votingStarted) ) g_voteCount = { 0,0, 0,0 } return PLUGIN_HANDLED } //thothie public getLegalMaps( checkMap[] ) { //Hoping to have legal and custom maps read in by file later new map[33]; get_mapname(map, 32); g_adjacentMaps = "none known"; if ( contain(map,"calruin") > -1 ) { g_adjacentMaps = "sfor"; } if ( contain(map,"challs") > -1 ) { g_adjacentMaps = "sfor"; } if ( contain(map,"daragoth") > -1 ) { g_adjacentMaps = "helena deralia mines"; } if ( contain(map,"deralia") > -1 ) { g_adjacentMaps = "daragoth"; } //this is to deal with duplicate name if ( contain(map,"edana") > -1 ) { if ( contain(map,"edanasewers") > -1 ) { g_adjacentMaps = "edana"; } else { g_adjacentMaps = "thornlands edanasewers"; } } if ( contain(map,"gatecity") > -1 ) { g_adjacentMaps = "mscave"; } if ( contain(map,"goblintown") > -1 ) { g_adjacentMaps = "mscave"; } if ( contain(map,"helena") > -1 ) { g_adjacentMaps = "thornlands daragoth keledrosprelude2"; } if ( contain(map,"heras") > -1 ) { g_adjacentMaps = "thornlands"; } if ( contain(map,"keledrosprelude2") > -1 ) { g_adjacentMaps = "helena [bossmap]"; } if ( contain(map,"keledrosruins") > -1 ) { g_adjacentMaps = "keledrosprelude2"; } if ( contain(map,"mines") > -1 ) { g_adjacentMaps = "daragoth"; } if ( contain(map,"mscave") > -1 ) { g_adjacentMaps = "gatecity goblintown thornlands"; } if ( contain(map,"sfor") > -1 ) { g_adjacentMaps = "calruin [hiddenmap] thornlands"; } if ( contain(map,"thornlands") > -1 ) { g_adjacentMaps = "heras helena sfor mscave edana"; } g_validMaps = 0 if ( contain(g_adjacentMaps, checkMap) > -1 ) g_validMaps = 1; if ( contain(g_rootTowns, checkMap) > -1 ) g_validMaps = 1; if ( contain(g_customMaps, checkMap) > -1 ) g_validMaps = 1; //set_cvar_string ("adjacentmaps",g_adjacentMaps); - this wont work either } //thothie public vote_check(id,level,cid) { //read in command new saytext[64]; read_args(saytext,63); //server_cmd ("say Debug: A Player Said %s", saytext); if ( contain(saytext,"votemap") > -1 ) { g_votedFromChat = 1; cmdVoteMap(id,level,cid); } }