AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Change map, when is x player on map (https://forums.alliedmods.net/showthread.php?t=263485)

Ziverts 05-26-2015 14:20

Change map, when is x player on map
 
Hello, hope for the help, I am looking plug-in that changes the folder when the server is x number of players

nnajko 05-26-2015 14:44

Re: Change map, when is x player on map
 
What do you mean by change folder?

Ziverts 05-26-2015 14:49

Re: Change map, when is x player on map
 
uh, i use google translate, i mean, map, not folder :/

nnajko 05-26-2015 15:09

Re: Change map, when is x player on map
 
Do you want to change to a specific map?

RaZ_HU 05-26-2015 17:34

Re: Change map, when is x player on map
 
This is an example how to change to a specified map.

Use cvar: cm_playercount "<number>" to set when the mod should change map. Default is 16 (you can change it in the code if you want).

PHP Code:

#include <amxmodx>

#define PLUGIN    "Change map at X playercount"
#define VERSION    "0.1"
#define AUTHOR    "RaZ_HU"

new playerCount;

public 
plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
playerCount register_cvar("cm_playercount","16")
    
    
set_task(20.0"clientnumCheck"0__"b"// Run check every 20 seconds
    
    
return PLUGIN_CONTINUE;
}

public 
clientnumCheck(client)
{
    new 
mapname[32]
    
get_mapname(mapname,31)
    
    
// Count how many players are on the server and check if the current map is the same as the wanted one
    
if(get_playersnum() >=playerCount && strcmp(mapname"de_dust2")) 
    {
        
server_cmd"changelevel de_dust2");
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



I wanted to add support to be able to change wanted map, but I don't know how to do that yet.

Ziverts 05-27-2015 00:44

Re: Change map, when is x player on map
 
RaZ_HU looks good, thank you, i test this this evening ~21:00 GMT +2 :)
Yes, it would be stylish if script dispense players question whether they want to be changed when the map number of players are like 16

RaZ_HU 05-27-2015 10:56

Re: Change map, when is x player on map
 
Quote:

Originally Posted by Ziverts (Post 2301517)
RaZ_HU looks good, thank you, i test this this evening ~21:00 GMT +2 :)
Yes, it would be stylish if script dispense players question whether they want to be changed when the map number of players are like 16

Your welcome, also I have forgot to set that current map should not be the same as the selected one. (tl;dr: I have forgot to put a !)
So use this corrected code:

PHP Code:

#include <amxmodx>

#define PLUGIN    "Change map at X playercount"
#define VERSION    "0.1"
#define AUTHOR    "RaZ_HU"

new playerCount;

public 
plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
playerCount register_cvar("cm_playercount","16")
    
    
set_task(20.0"clientnumCheck"0__"b"// Run check every 20 seconds
    
    
return PLUGIN_CONTINUE;
}

public 
clientnumCheck(client)
{
    new 
mapname[32]
    
get_mapname(mapname,31)
    
    
// Count how many players are on the server and check if the current map is the same as the wanted one
    
if(get_playersnum() >=playerCount && !strcmp(mapname"de_dust2")) 
    {
        
server_cmd"changelevel de_dust2");
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



Ziverts 05-27-2015 16:13

Re: Change map, when is x player on map
 
Quote:

Originally Posted by RaZ_HU (Post 2301715)
Your welcome, also I have forgot to set that current map should not be the same as the selected one. (tl;dr: I have forgot to put a !)
So use this corrected code:

Thank you very much, everything works perfectly :)


All times are GMT -4. The time now is 20:21.

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