AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved check players =< 1 changelevel fy_pool_day (https://forums.alliedmods.net/showthread.php?t=324248)

rx1983 05-10-2020 12:54

check players =< 1 changelevel fy_pool_day
 
check players =< 1 changelevel fy_pool_day

I need a seimple plugin that changes the map if the server is zero or one player. automatically,

so that this is verified at the start round of the match after a delay of 30 seconds.

not work, unnaprovad
https://forums.alliedmods.net/showthread.php?t=140481

very old not work
https://forums.alliedmods.net/showthread.php?p=52535

very complex, very options... not simple, chanched commands in server....
https://forums.alliedmods.net/showthread.php?p=194690

OciXCrom 05-10-2020 13:53

Re: check players =< 1 changelevel fy_pool_day
 
https://forums.alliedmods.net/showthread.php?t=323184

rx1983 05-12-2020 09:23

Re: check players =< 1 changelevel fy_pool_day
 
how to put as topic solved?

iceeedr 05-12-2020 10:01

Re: check players =< 1 changelevel fy_pool_day
 
Quote:

Originally Posted by rx1983 (Post 2699712)
how to put as topic solved?

Edit 1st post, advanced, solved.

rx1983 05-12-2020 10:11

Re: check players =< 1 changelevel fy_pool_day
 
VALEU !

rx1983 05-12-2020 15:36

Re: check players =< 1 changelevel fy_pool_day
 
not work, in changed map players connectad...

PHP Code:

#include <amxmodx>

#if !defined client_disconnected
#define client_disconnected client_disconnect
#endif

new g_pPlayersNeeded
new g_pChangeTo
new g_iPlayerCount

public plugin_init()
{
    
register_plugin("changed to fy_pool_day""1.0""OciXCrom")
    
g_pPlayersNeeded register_cvar("change_players_needed""1")
    
g_pChangeTo register_cvar("change_to_map""fy_pool_day")
}

public 
plugin_cfg()
{
    new 
szCurrentMap[32], szChangeTo[32]
    
get_mapname(szCurrentMapcharsmax(szCurrentMap))
    
get_pcvar_string(g_pChangeToszChangeTocharsmax(szChangeTo))

    if(
equali(szCurrentMapszChangeTo))
    {
        
pause("d")
    }
}

public 
client_putinserver(id)
{
    if(++
g_iPlayerCount <= get_pcvar_num(g_pPlayersNeeded))
    {
        new 
szMap[32]
        
get_pcvar_string(g_pChangeToszMapcharsmax(szMap))

        
#if defined engine_changelevel
        
engine_changelevel(szMap)
        
#else
        
server_cmd("changelevel %s"szMap)
        
#endif
    
}
}

public 
client_disconnected(id)
{
    
g_iPlayerCount--


when changing the map it shows the number of players and changes the map again before starting, so this plugin does not work.
it does not allow the map if any other than fy_pool_day :down::down:

OciXCrom 05-12-2020 15:48

Re: check players =< 1 changelevel fy_pool_day
 
It works. It does that because the number of players is always <= 1 when the map starts. I added a delay to prevent this:

Code:
#include <amxmodx> #if !defined client_disconnected     #define client_disconnected client_disconnect #endif new g_pPlayersNeeded new g_pChangeTo new g_pWait new g_iPlayerCount new bool:g_bActive public plugin_init() {     register_plugin("Change Map on X Players", "1.1", "OciXCrom")     g_pPlayersNeeded = register_cvar("change_players_needed", "10")     g_pChangeTo = register_cvar("change_to_map", "fy_snow")     g_pWait = register_cvar("change_wait", "30") } public plugin_cfg() {     new szCurrentMap[32], szChangeTo[32]     get_mapname(szCurrentMap, charsmax(szCurrentMap))     get_pcvar_string(g_pChangeTo, szChangeTo, charsmax(szChangeTo))     if(equali(szCurrentMap, szChangeTo))     {         pause("d")     }     set_task(get_pcvar_float(g_pWait), "activate_plugin", .flags = "c") } public activate_plugin() {     g_bActive = true     if(g_iPlayerCount <= get_pcvar_num(g_pPlayersNeeded))     {         change_the_map()     } } public client_putinserver(id) {     if(++g_iPlayerCount <= get_pcvar_num(g_pPlayersNeeded) && g_bActive)     {         change_the_map()     } } public client_disconnected(id) {     g_iPlayerCount-- } public change_the_map() {     g_bActive = false     new szMap[32]     get_pcvar_string(g_pChangeTo, szMap, charsmax(szMap))     #if defined engine_changelevel     engine_changelevel(szMap)     #else     server_cmd("changelevel %s", szMap)     #endif }

rx1983 05-13-2020 11:23

Re: check players =< 1 changelevel fy_pool_day
 
APPROVED

Alber9091 05-13-2020 11:47

Re: check players =< 1 changelevel fy_pool_day
 
@OciXCrom, Congratulations !!
@HamletEagle, its time for you to retire :p we got new AMXX Approver.


All times are GMT -4. The time now is 00:52.

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