Raised This Month: $ Target: $400
 0% 

amx_votemap not allowed in the first 3 minutes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
G u i l l e
Junior Member
Join Date: Nov 2006
Old 11-01-2006 , 01:40   amx_votemap not allowed in the first 3 minutes
Reply With Quote #1

hi, i need a modification of amx_votemap, i need that the amx_votemap not allowed in the first 3 minutes of the map, i dont know how to do this.

thanks, and sorry my english, is very bad :S
G u i l l e is offline
Old 11-01-2006, 06:14
NowakFilip
This message has been deleted by Greentryst. Reason: stop spewing inaccurate crap
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-01-2006 , 10:05   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #2

@NowakFlip:
Stop being unhelpful. Just stop. At best it just confuses people.

@G u i l l e:
Simply done. I'll show you the code changes I made to allow the feature of not allowing an amx_votemap until a set number of seconds has passed.

I've also made the changes I'm showing in the attached adminvote.sma file. I applied the changes against the 1.76b version of adminvote.sma.

Please note that while I am very confident the changes I supplied will work as advertised, I have not actually tested the code. Please respond after you've tested it to let me know if it works as expected.

After making the changes, or using the supplied file, you'll need to add the following to your amxx.cfg file (for 3 minutes, you'll want to change the 0.0 to 180.0):
Code:
// seconds after map start after which map voting can begin
amx_votemap_start 0.0
I only made changes in two functions, so that's all I'll be showing. The changes I made are highlighted in each function.

In plugin_init() I only added a single line which registers the new CVAR.
Code:
public plugin_init() {     register_plugin("Admin Votes", AMXX_VERSION_STR, "AMXX Dev Team")     register_dictionary("adminvote.txt")     register_dictionary("common.txt")     register_dictionary("mapsmenu.txt")     register_menucmd(register_menuid("Change map to "), MENU_KEY_1|MENU_KEY_2, "voteCount")     register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")     register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")     register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")     register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2, "voteCount")     register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")     register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")     register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")     register_concmd("amx_voteban", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")     register_concmd("amx_vote", "cmdVote", ADMIN_VOTE, "<question> <answer#1> <answer#2>")     register_concmd("amx_cancelvote", "cmdCancelVote", ADMIN_VOTE, "- cancels last vote")     register_cvar("amx_votemap_start", "0.0")     g_coloredMenus = colored_menus() }
In cmdVoteMap() I added the one if block near the top of the function.
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 }
Attached Files
File Type: sma Get Plugin or Get Source (adminvote.sma - 895 views - 15.7 KB)
__________________
Brad is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 11-01-2006 , 10:11   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #3

sorry offtopic but Brad how do you Highlight parts of code like that?
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-01-2006 , 10:32   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #4

One word: Magic.

If you'd like a more substantial answer, continue reading.

To highlight a line of code in any code window on this forum, place @@ at the start of the line you want highlighted.
__________________
Brad is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 11-01-2006 , 10:51   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #5

To find out yourself next time, just hit the quote button and read the bbcode.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Old 11-01-2006, 15:25
NowakFilip
This message has been deleted by Greentryst. Reason: stop spewing inaccurate crap
Old 11-01-2006, 15:42
MaximusBrood
This message has been deleted by Greentryst. Reason: reply to deleted post
Old 11-01-2006, 15:46
NowakFilip
This message has been deleted by Greentryst. Reason: stop spewing inaccurate crap
Old 11-01-2006, 16:53
Brad
This message has been deleted by Greentryst. Reason: reply to deleted post
Old 11-01-2006, 17:43
NowakFilip
This message has been deleted by Greentryst. Reason: stop spewing inaccurate crap
Old 11-01-2006, 18:14
SweatyBanana
This message has been deleted by Greentryst. Reason: reply to deleted post
Old 11-01-2006, 20:00
NowakFilip
This message has been deleted by Greentryst. Reason: stop spewing inaccurate crap
Old 11-01-2006, 23:32
Nostrodamous
This message has been deleted by Greentryst. Reason: reply to deleted post
VEN
Veteran Member
Join Date: Jan 2005
Old 11-02-2006 , 03:39   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #6

I know the way how to do it without additional coding but one issue: it will affect on any amxx voting (not just amx_votemap), let me know if interested.
I'm not talking about NowakFilip's way, he is obviously messed two different things.
VEN is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-02-2006 , 08:20   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #7

You're referring to setting the value of amx_last_voting, correct?
__________________
Brad is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-02-2006 , 09:38   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #8

Yes.
VEN is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 11-02-2006 , 09:44   Re: amx_votemap not allowed in the first 3 minutes
Reply With Quote #9

Quote:
Originally Posted by MaximusBrood View Post
To find out yourself next time, just hit the quote button and read the bbcode.
I did and on my screen they were not highlighted and couldnt find anything in the BB code to do something but thanks for telling me brad
Code:
 Wootage
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Reply



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 04:51.


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