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_Map, defmap, charsmax(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_Times, nCvar_Map, nMaps
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_Map, nMap, charsmax(nMap))
if(nPlayers == 0)
{
nMaps++
if(nMaps == get_pcvar_num(nCvar_Times))
{
server_cmd("changelevel %s", nMap)
}
}
}