Raised This Month: $ Target: $400
 0% 

Map Extend


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vi3tmofo
Member
Join Date: Jun 2009
Old 05-22-2011 , 19:32   Map Extend
Reply With Quote #1

hi , i want a plugin that 5 min untill the map end it pops up a menu so players can vote to extend the map for 10, 20 min. please help me. i play cs 1.6 classic.

example pop up menu..

Extend Map?
1. 10 min
2. 20 min
3. Don't Extend



Code:
/* Plugin generated by AMXX-Studio */
/*
*
* v. 1.1 fixed exploit. you can no longer extend the map by a negative number.
* v. 1.0 initial release
*
*
*/
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Map Extender"
#define VERSION "1.1"
#define AUTHOR "jsauce"
//#define DEBUG        // For debugging only.
#define MAX_MAPS 32    // Change this if you have more than 32 maps in mapcycle.
#define MAPCYCLE    // Check mapcycle to prevent non mapcycle files from being extended.
#define EXTENDMAX 3    // Maximum number of times a map may be extended by anyone.
#define EXTENDTIME 15    // Maximum amount of time any map can be extended at once.

new user_limit = 0    
new bool:cyclerfile
new gNum = 0
new gMap[64] 

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR)
    register_concmd("amx_extend","admin_extend",ADMIN_LEVEL_A,"<added time to extend> : ex. 5, if you want to extend it five more minutes.")
    #if defined DEBUG
    register_concmd("amx_user_limit","extend_user_limit",ADMIN_RCON,"Extend user_limit for debugging only.")
    #endif
    #if defined MAPCYCLE
    new map[64], i, line = 0
    get_mapname(map,63)
    #if defined DEBUG
    new newtext[256]
    format(newtext,255,"DEBUG: mapname %s",map)
    write_file("debugger.txt",newtext,-1)
    #endif
      while ( gNum < MAX_MAPS && read_file("mapcycle.txt",line++,gMap,63,i) )
    {
        #if defined DEBUG
        new newtext[256]
        format(newtext,255,"DEBUG: gNum is %i line is %i gMap is %s",gNum,line,gMap)
        write_file("debugger.txt",newtext,-1)
        #endif
        if ( gMap[0] == ';' ) continue

        if (equali(gMap,map))
        {
            cyclerfile = true
            break
        }
        ++gNum
    }
    #endif
    return PLUGIN_CONTINUE
} 

public admin_extend(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED
    
    new arg[32],name[32]
    read_argv(1,arg,31)
    get_user_name(id,name,31)
    #if defined MAPCYCLE
    #if defined DEBUG
    client_print(id,print_chat,"DEBUG: CyclerFile is %s",cyclerfile)
    #endif
    if (!cyclerfile)
    {
        client_print(id,print_chat,"[AMXX] Maps that are not in the mapcycle cannot be extended.")
        return PLUGIN_HANDLED
    }
    #endif
    if (arg[0])
    {
        if(containi(arg,"-") != -1)
        {
            #if defined DEBUG
            client_print(id,print_chat,"DEBUG: tlimit is neg at %i",arg)
            #endif
            client_print(id,print_chat,"[AMXX] You cannot extend the maptime by a negative number.")
            return PLUGIN_HANDLED
        }
        new tlimit = str_to_num(arg)
        #if defined DEBUG
        client_print(id,print_chat,"DEBUG: tlimit is %i user_limit is %i",tlimit,user_limit)
        #endif
        if (user_limit >= EXTENDMAX)
        {
            #if defined DEBUG
            client_print(id,print_chat,"DEBUG: Script has reached user_limit max of %i",user_limit)
            #endif
            client_print(id,print_chat,"[AMXX] No user may extend any map more than %i times.",EXTENDMAX)
            return PLUGIN_HANDLED
        }
        if (tlimit > EXTENDTIME)
        {
            #if defined DEBUG
            client_print(id,print_chat,"DEBUG: Script has reached tlimit max of %i",tlimit)
            #endif
            client_print(id,print_chat,"[AMXX] No map may be extended longer than %i minutes at a time.",EXTENDTIME)
            tlimit = EXTENDTIME
        }
        #if defined DEBUG
        client_print(id,print_chat,"DEBUG: Script has reached timelimit change of %i",tlimit)
        #endif
        set_cvar_float("mp_timelimit",get_cvar_float("mp_timelimit") + tlimit)
        client_print(0,print_chat,"[AMXX] %s has extended the map time by %i minutes",name,tlimit)
        ++user_limit
        return PLUGIN_HANDLED
    }
    
    return PLUGIN_HANDLED
}
#if defined DEBUG
public extend_user_limit(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED
    
    new arg[32]
    read_argv(1,arg,31)
    
    if (arg[0])
    {
        
        user_limit = str_to_num(arg) + user_limit
        client_print(id,print_chat,"DEBUG: Added %d to user_limit to have %i total",arg[0],user_limit)
    }
    
    return PLUGIN_HANDLED
}
#endif

Last edited by Emp`; 05-22-2011 at 19:59.
vi3tmofo is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 05-23-2011 , 15:31   Re: Map Extend
Reply With Quote #2

no one here know how to do it?
vi3tmofo is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 05-24-2011 , 00:03   Re: Map Extend
Reply With Quote #3

register_cvar("amx_extendmap_max", "90")
register_cvar("amx_extendmap_step", "15")

from the original AMXX mapchooser

no need to use another plugin because it's already made.
DjOptimuS is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 05-24-2011 , 00:19   Re: Map Extend
Reply With Quote #4

where do i add this


register_cvar("amx_extendmap_max", "90")
register_cvar("amx_extendmap_step", "15")
vi3tmofo is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-24-2011 , 01:15   Re: Map Extend
Reply With Quote #5

Quote:
Originally Posted by vi3tmofo View Post
where do i add this


register_cvar("amx_extendmap_max", "90")
register_cvar("amx_extendmap_step", "15")
YOu don't put it anywhere. He is just saying to use mapchooser. Do you have a map vote at the end of the map?
__________________
fysiks is online now
vi3tmofo
Member
Join Date: Jun 2009
Old 05-24-2011 , 19:18   Re: Map Extend
Reply With Quote #6

yes i do have a mapchooser at end of map, but it never have the option to extend the map
vi3tmofo is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-24-2011 , 23:24   Re: Map Extend
Reply With Quote #7

Yes you do, those two cvars are from mapchooser's source, so it has map extending.
__________________
Hunter-Digital is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-24-2011 , 23:51   Re: Map Extend
Reply With Quote #8

amxx.cfg
Code:
// Max. time to which map can be extended
//
// Default value: 90
amx_extendmap_max 90

// Step for each extending
//
// Default value: 15
amx_extendmap_step 15
__________________
fysiks is online now
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 21:59.


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