Raised This Month: $ Target: $400
 0% 

just 1 map to vote


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-09-2006 , 22:16   Re: amx_votemap, just 1 map to vote
Reply With Quote #4

Quote:
Originally Posted by G u i l l e View Post
Code:
public cmdVoteMap(id, level, cid)
{
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    if (get_gametime() < get_cvar_float("amx_votemap_start"))
    {
        console_print(id, "%L", id, "VOTING_NOT_ALLOW")
        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 argc = read_argc()
    if (argc > 5) argc = 5
    
    g_validMaps = 0
    g_optionName[0][0] = 0
    //g_optionName[1][0] = 0
    //g_optionName[2][0] = 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_validMaps++
    }
    
    if (g_validMaps == 0)
    {
        new lMaps[16]
        
        format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
        console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
        return PLUGIN_HANDLED
    }

    new menu_msg[256], len = 0
    new keys = 0
    
    if (g_validMaps > 1)
    {
        keys = MENU_KEY_0
        len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
        new temp[128]
        
        for (new a = 0; a < g_validMaps; ++a)
        {
            format(temp, 127, "%d.  %s^n", a+1, g_optionName[a])
            len += copy(menu_msg[len], 255-len, temp)
            keys |= (1<<a)
        }
        
        format(menu_msg[len], 255-len, "^n0.  %L", LANG_SERVER, "NONE")
        g_yesNoVote = 0
    } else {
        new lChangeMap[32], lYes[16], lNo[16]
        
        format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
        format(lYes, 15, "%L", LANG_SERVER, "YES")
        format(lNo, 15, "%L", LANG_SERVER, "NO")
        format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1.  %s^n2.  %s" : "%s %s?^n^n1.  %s^n2.  %s", lChangeMap, g_optionName[0], lYes, lNo)
        keys = MENU_KEY_1|MENU_KEY_2
        g_yesNoVote = 1
    }
    
    new authid[32], name[32]
    
    get_user_authid(id, authid, 31)
    get_user_name(id, name, 31)
    
    if (argc == 2)
        log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
    else
        log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0]) //, g_optionName[1], g_optionName[2], g_optionName[3])

    new lTag[16], activity = get_cvar_num("amx_show_activity")
    
    if (activity > 0)
    {
        new players[32], pnum
        
        get_players(players, pnum, "c")
        for (new i = 0; i < pnum; i++)
        {
            format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
            
            switch (activity)
            {
                case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_2", lTag, name)
                case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_1", lTag)
            }
        }
    }

    g_execResult = true
    new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
    
    set_cvar_float("amx_last_voting", get_gametime() + vote_time)
    g_voteRatio = get_cvar_float("amx_votemap_ratio")
    g_Answer = "changelevel %s"
    show_menu(0, keys, menu_msg, floatround(vote_time), (g_validMaps > 1) ? "Choose map: " : "Change map to ")
    set_task(vote_time, "checkVotes", 99889988)
    g_voteCaller = id
    console_print(id, "%L", id, "VOTING_STARTED")
    g_voteCount = {0, 0, 0, 0}
    
    return PLUGIN_HANDLED
}
this is the code for amx_votemap, how can i change the option votemap 4 maps, to just 1 map.

thanks

Change
Code:
    new argc = read_argc()     if (argc > 5) argc = 5         g_validMaps = 0     g_optionName[0][0] = 0     //g_optionName[1][0] = 0     //g_optionName[2][0] = 0     //g_optionName[3][0] = 0
to
Code:
    new argc = read_argc()     if (argc > 2) argc = 2         g_validMaps = 0     g_optionName[0][0] = 0     //g_optionName[1][0] = 0     //g_optionName[2][0] = 0     //g_optionName[3][0] = 0
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode