Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#define PLUGIN "Map Extender"
#define VERSION "1.1"
#define AUTHOR "jsauce"
#define Edit "dipl.ing.Ju(R)[A]"
//#define DEBUG // For debugging only.
#define MAX_MAPS 32 // Change this if you have more than 32 maps in mapcycle.
#define EXTENDMAX 1 // Maximum number of times a map may be extended by anyone.
#define EXTENDTIME 25 // Maximum amount of time any map can be extended at once.
new user_limit = 0
new gNum = 0
new gMap[64]
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_concmd("amx_extend","admin_extend",ADMIN_KICK,"<dodano vrijeme za produziti> : npr. 5, Ako zelis produziti malo vise mozes najvise do 25.")
#if defined DEBUG
register_concmd("amx_user_limit","extend_user_limit",ADMIN_RCON,"Produziti user_limit je samo za debug.")
#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 (arg[0])
{
if(containi(arg,"-") != -1)
{
#if defined DEBUG
client_print(id,print_chat,"DEBUG: Timelimit is negavtiv %i",arg)
#endif
client_print(id,print_chat,"[AMXX] Nemozes produziti mapu negativnim brojem.")
return PLUGIN_HANDLED
}
new tlimit = str_to_num(arg)
#if defined DEBUG
client_print(id,print_chat,"DEBUG: timelimit je %i user_limit je %i",tlimit,user_limit)
#endif
if (user_limit >= EXTENDMAX)
{
#if defined DEBUG
client_print(id,print_chat,"DEBUG: Skripta je dostigla user_limit maximum %i",user_limit)
#endif
client_print(id,print_chat,"[AMXX] Nema vise korisnika koji moze produziti mapu vise od %i ovog vremena.",EXTENDMAX)
return PLUGIN_HANDLED
}
if (tlimit > EXTENDTIME)
{
#if defined DEBUG
client_print(id,print_chat,"DEBUG: Skritpa je dostigla maximum od %i",tlimit)
#endif
client_print(id,print_chat,"[AMXX] Nijedna mapa ne moze biti produzena vise od %i minuta.",EXTENDTIME)
tlimit = EXTENDTIME
}
#if defined DEBUG
client_print(id,print_chat,"DEBUG: Skripta je dostigla timelimit %i",tlimit)
#endif
set_cvar_float("mp_timelimit",get_cvar_float("mp_timelimit") + tlimit)
ColorChat(0, GREEN,"[AMXX] ^1Admin ^3%s ^1je produzio mapu za ^3%i ^1minuta.",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: Dodano %d u user_limit da imas %i total",arg[0],user_limit)
}
return PLUGIN_HANDLED
}
#endif
I found this plugin and what is wrong about this is...
I want to extend map i used command on...
But this happens. It extends time for all maps... not only one i wanted.