AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   just 1 map to vote (https://forums.alliedmods.net/showthread.php?t=48311)

G u i l l e 12-09-2006 19:00

just 1 map to vote
 
...

The Specialist 12-09-2006 19:40

Re: amx_votemap, just 1 map to vote
 
can you post the code in sma tags.

slmclarengt 12-09-2006 22:16

Re: amx_votemap, just 1 map to vote
 
Quote:

Originally Posted by G u i l l e (Post 413042)
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


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

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