Raised This Month: $ Target: $400
 0% 

map check


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-19-2013 , 03:53   map check
Reply With Quote #1

I have a small plugin which changes to 'default' map if there no players found in server.

I would like to hear some improvements for this plugin. I'm thinking of changing mp_timelimit to 0 when map is default and no players found and change it back to 35 when somebody connects. But the problem is that if nobody connects to server for more than 35mins after connection server will instantly change the map. What alternatives could i do becouse of that?

PHP Code:
#include <amxmodx>
     
new nCvar_TimesnCvar_MapnMaps
     
public plugin_init()
{
    
register_plugin("Map check""1.1""None")
       
    
nCvar_Times register_cvar("nmap_check_time""3")
    
nCvar_Map register_cvar("nmap_check_map""de_dust2_2x2")

    new 
mapname[32
    
get_mapname(mapname,31)

    if(
equali(mapname"de_dust2_2x2"))
    {
        return 
PLUGIN_HANDLED
    
}
    else
    {
        
set_task(60.0"nice_map_check"___"b")
    }
    return 
PLUGIN_CONTINUE
}
     
public 
nice_map_check()
{
    new 
nMap[40], nPlayers get_playersnum()
       
    
get_pcvar_string(nCvar_MapnMapcharsmax(nMap))
       
    if(
nPlayers == 0)
    {
        
nMaps++
           
        if(
nMaps == get_pcvar_num(nCvar_Times))
        {
            
server_cmd("changelevel %s"nMap)
        }
    }

GhostMan 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 10:52.


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