AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   same map when no players in server (https://forums.alliedmods.net/showthread.php?t=216389)

GhostMan 05-20-2013 13:30

same map when no players in server
 
I have two questions:

1. What are the possibilities to change 'equali' part that there wouldnt be 'de_dust2_2x2'?
This doesnt work (can't compile, i guess there was error 'no 3rd argument allowed' or something)
PHP Code:

    nCvar_Map register_cvar("nmap_check_map""de_dust2_2x2")

    new 
defmap[40]
    
    
get_pcvar_string(nCvar_Mapdefmapcharsmax(defmap))

    if(
equali(mapname"%s"defmap))
    {
        return 
PLUGIN_HANDLED
    


2. Now when there is no players in server map changes to de_dust2_2x2. After timelimit runs out map changes to any other. If there is still no players it changes back to de_dust2_2x2.....

What i would like is that if there is no players in the server so map stays de_dust2_2x2 untill somebody connects. After that timelimit sets to the default value.
The problems is if that you set timelimit to 0 and it says like that longer than default value, so after you change it back from 0 to default value map immediately changes.

PHP Code:

#include <amxmodx>
     
new nCvar_TimesnCvar_MapnMaps
     
public plugin_init()
{
    
register_plugin("Map Change""1.2""-")
       
    
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"map_check"___"b")
    }
    return 
PLUGIN_CONTINUE
}
     
public 
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)
        }
    }




All times are GMT -4. The time now is 16:28.

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