Raised This Month: $51 Target: $400
 12% 

Map number of people plug-in request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lihing
Junior Member
Join Date: Oct 2023
Old 10-23-2023 , 13:23   Map number of people plug-in request
Reply With Quote #1

If the number of people is less than 10, it will automatically change to popular maps, such as de_dust2 de_inferno....
More than 10 people execute the map within the mapcycle loop
If there are less than 10 people, the server will prompt

I have searched and almost all of them are decided by voting.

Thank you.
Lihing is offline
731
Member
Join Date: Aug 2006
Old 10-25-2023 , 08:28   Re: Map number of people plug-in request
Reply With Quote #2

Command and parameter instructions:

amx_addvotetime <hh:mm> <hh:mm> - Increases the automatic voting time range. A maximum of eight time ranges can be set. Each time range is specified by using this command
amx_hotmaps <map> [map] ... [map] - Specify a maximum of 16 popular maps, only vote for popular maps, if the map is already popular, no more voting.
amx_minplayersnum <n> - Votes automatically only when the number of people is less than this value. The default value is 6
amx_votedelay <delaytime> - How long does voting start before the number of people is less than the specified value, in seconds. The default value is 60 seconds
amx_autovotemap <1|0> - Whether to enable this function. The default value is 1

Examples of use:

Add the following content to amxx.cfg:

amx_addvotetime "230" "08:00"
amx_hotmaps de_dust2 de_aztec de_inferno

Note that the time must be referred to by half corner double quotation marks ("), as in the example above.
Attached Files
File Type: sma Get Plugin or Get Source (auto_votemap.sma - 38 views - 4.5 KB)
731 is online now
Old 10-25-2023, 08:33
sPed
This message has been deleted by sPed.
Lihing
Junior Member
Join Date: Oct 2023
Old 10-25-2023 , 20:03   Re: Map number of people plug-in request
Reply With Quote #3

Quote:
Originally Posted by 731 View Post
Command and parameter instructions:

amx_addvotetime <hh:mm> <hh:mm> - Increases the automatic voting time range. A maximum of eight time ranges can be set. Each time range is specified by using this command
amx_hotmaps <map> [map] ... [map] - Specify a maximum of 16 popular maps, only vote for popular maps, if the map is already popular, no more voting.
amx_minplayersnum <n> - Votes automatically only when the number of people is less than this value. The default value is 6
amx_votedelay <delaytime> - How long does voting start before the number of people is less than the specified value, in seconds. The default value is 60 seconds
amx_autovotemap <1|0> - Whether to enable this function. The default value is 1

Examples of use:

Add the following content to amxx.cfg:


amx_addvotetime "230" "08:00"
amx_hotmaps de_dust2 de_aztec de_inferno

Note that the time must be referred to by half corner double quotation marks ("), as in the example above.

This is cool bro
But is there anyone who just changes the map without voting?
Will having a BOT affect the plug-in?
Thanks
Lihing is offline
731
Member
Join Date: Aug 2006
Old 10-26-2023 , 13:44   Re: Map number of people plug-in request
Reply With Quote #4

I have rewritten the code. If the number of players is less than 10, the server will randomly replace popular maps. If the number of players is greater than 10, the server will not replace any maps
Attached Files
File Type: sma Get Plugin or Get Source (Auto_Change_Map.sma - 26 views - 1.3 KB)
731 is online now
Lihing
Junior Member
Join Date: Oct 2023
Old 10-26-2023 , 21:40   Re: Map number of people plug-in request
Reply With Quote #5

Quote:
Originally Posted by 731 View Post
I have rewritten the code. If the number of players is less than 10, the server will randomly replace popular maps. If the number of players is greater than 10, the server will not replace any maps
Thank you very much for helping me

1.9.0 cannot compile
1.8.1 can compile

Last edited by Lihing; 10-26-2023 at 21:52.
Lihing is offline
731
Member
Join Date: Aug 2006
Old 10-27-2023 , 00:08   Re: Map number of people plug-in request
Reply With Quote #6

I have never used version 1.9.0 and have been using version 1.8.2
Version 1.8.2 requires installation of colorchat.inc made by ConnorMcLeod. I don't know why 1.9.0 can't compile because I haven't used this version
Attached Files
File Type: inc colorchat.inc (4.9 KB, 11 views)
731 is online now
Lihing
Junior Member
Join Date: Oct 2023
Old 10-27-2023 , 03:52   Re: Map number of people plug-in request
Reply With Quote #7

Quote:
Originally Posted by 731 View Post
I have never used version 1.9.0 and have been using version 1.8.2
Version 1.8.2 requires installation of colorchat.inc made by ConnorMcLeod. I don't know why 1.9.0 can't compile because I haven't used this version
Thank you very much for your help
Lihing is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-27-2023 , 06:55   Re: Map number of people plug-in request
Reply With Quote #8

There...

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>

#if AMXX_VERSION_NUM <= 182
#define client_disconnected client_disconnect
#endif

#if !defined EOS
#define EOS 0
#endif

#define PLUGIN  "Map System PPC"
#define VERSION "1.0"
#define AUTHOR  "Natsheh"

#define TASK_CHECK_MAP 9000

new g_iPlayersCountbool:g_bValidMapPPC, Array:g_arraymapsppc Invalid_ArrayTrie:g_triemapsppc Invalid_Trie;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
g_arraymapsppc ArrayCreate(.cellsize 64);

    if(
g_arraymapsppc == Invalid_Array) return;

    
g_triemapsppc TrieCreate();

    if(
g_triemapsppc == Invalid_Trie)
    {
        
ArrayDestroy(g_arraymapsppc);
        return;
    }

    
ReadConfigMapSystemPPC();
}

public 
plugin_end()
{
    
ArrayDestroy(g_arraymapsppc);
    
TrieDestroy(g_triemapsppc);
}

ReadConfigMapSystemPPC()
{
    new 
fp fopen("mapsystemppc.txt""at+");

    if(!
fp) return;

    new 
szBuffer[128], szMap[64], szPlayersMaxNum[4];

    while(
fgets(fpszBuffercharsmax(szBuffer)) > 0)
    {
        
trim(szBuffer);

        switch( 
szBuffer[0] )
        {
            case 
EOS'/'';''#': continue;
            default:
            {
                
parse(szBufferszMapcharsmax(szMap), szPlayersMaxNumcharsmax(szPlayersMaxNum));
                
remove_quotes(szMap);
                
remove_quotes(szPlayersMaxNum);

                
ArrayPushString(g_arraymapsppcszMap);
                
TrieSetCell(g_triemapsppcszMapstr_to_num(szPlayersMaxNum));
            }
        }
    }

    
fclose(fp);
}

public 
client_authorized(id)
{
    
g_iPlayersCount++;

    
remove_task(TASK_CHECK_MAP);
    
set_task(5.0"Check_CurrentMap"TASK_CHECK_MAP);
}

public 
client_disconnected(id)
{
    
g_iPlayersCount--;

    
remove_task(TASK_CHECK_MAP);
    
set_task(5.0"Check_CurrentMap"TASK_CHECK_MAP);
}

public 
Check_CurrentMap()
{
    new 
szCurrentMap[64], iMapMaxPlayers;
    
get_mapname(szCurrentMapcharsmax(szCurrentMap));

    
g_bValidMapPPC false;

    if(
TrieKeyExists(g_triemapsppcszCurrentMap))
    {
        
TrieGetCell(g_triemapsppcszCurrentMapiMapMaxPlayers);

        if(
g_iPlayersCount <= iMapMaxPlayers)
            
g_bValidMapPPC true;
    }

    if(!
g_bValidMapPPC)
    {
        new 
szMap[64], ArraySize(g_arraymapsppc);

        new Array:
arraytempmaps ArrayCreate64 );

        while( 
i-- > 0)
        {
            
ArrayGetString(g_arraymapsppciszMapcharsmax(szMap));

            
TrieGetCell(g_triemapsppcszMapiMapMaxPlayers);

            if(
g_iPlayersCount <= iMapMaxPlayers)
            {
                
ArrayPushString(arraytempmapsszMap);
            }
        }

        new 
iSize;
        if((
iSize ArraySize(arraytempmaps)) > 0)
        {
            
ArrayGetString(arraytempmapsrandom(iSize), szMapcharsmax(szMap));
        }

        
ArrayDestroy(arraytempmaps);

        if(
iSize 0)
        {
            
server_cmd("changelevel ^"%s^""szMap);
        }
        else
        {
            
server_cmd("mp_timelimit 30");
        }
    }

Open file mapsystemppc.txt and add the popular maps with the number of maximum players next to their name, an example file...

Code:
// Will change to de_dust2 if the number of players are 16 and under...
de_dust2 16
// Will change to de_inferno if the number of players are 8 and under...
de_inferno 8

// etc....
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-27-2023 at 16:10.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Lihing
Junior Member
Join Date: Oct 2023
Old 10-27-2023 , 11:47   Re: Map number of people plug-in request
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
There...

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>

#define PLUGIN  "Map System PPC"
#define VERSION "1.0"
#define AUTHOR  "Natsheh"

#define TASK_CHECK_MAP 9000

new g_iPlayersCountbool:g_bValidMapPPC, Array:g_arraymapsppc Invalid_Arrayg_triemapsppc Invalid_Trie;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
g_arraymapsppc ArrayCreate(.cellsize 64);

    if(
g_arraymapsppc == Invalid_Array) return;

    
g_triemapsppc TrieCreate();

    if(
g_triemapsppc == Invalid_Trie)
    {
        
ArrayDestroy(g_arraymapsppc);
        return;
    }

    
ReadConfigMapSystemPPC();
}

public 
plugin_end()
{
    
ArrayDestroy(g_arraymapsppc);
    
ArrayDestroy(g_triemapsppc);
}

ReadConfigMapSystemPPC()
{
    new 
fp fopen("mapsystemppc.txt""at+");

    if(!
fp) return;

    new 
szBuffer[128], szMap[64], szPlayersMaxNum[4];

    while(
fgets(fpszBuffercharsmax(szBuffer)) > 0)
    {
        
trim(szBuffer);

        switch( 
szBuffer[0] )
        {
            case 
'/'';''#': continue;
            default:
            {
                
parse(szBufferszMapcharsmax(szMap), szPlayersMaxNumcharsmax(szPlayersMaxNum));
                
remove_quotes(szMap);
                
remove_quotes(szPlayersMaxNum);

                
ArrayPushString(g_arraymapsppcszMap);
                
TrieSetCell(g_triemapsppcszMapstr_to_num(szPlayersMaxNum));
            }
        }
    }

    
fclose(fp);
}

public 
client_authorized(id)
{
    
g_iPlayersCount++;

    
remove_task(TASK_CHECK_MAP);
    
set_task(5.0"Check_CurrentMap"TASK_CHECK_MAP);
}

public 
client_disconnected(id)
{
    
g_iPlayersCount--;
}

public 
Check_CurrentMap()
{
    new 
szCurrentMap[64], iMapMaxPlayers;
    
get_mapname(szCurrentMapcharsmax(szCurrentMap));

    
g_bValidMapPPC false;

    if(
TrieKeyExists(g_triemapsppcszCurrentMap))
    {
        
TrieGetCell(g_triemapsppcszCurrentMapiMapMaxPlayers);

        if(
g_iPlayersCount <= iMapMaxPlayers)
            
g_bValidMapPPC true;
    }

    if(!
g_bValidMapPPC)
    {
        new 
szMap[64], ArraySize(g_arraymapsppc);

        new Array:
g_arraytempmaps ArrayCreate64 );

        while( 
i-- > 0)
        {
            
ArrayGetString(g_arraymapsppciszMapcharsmax(szMap));

            
TrieGetCell(g_triemapsppcszMapiMapMaxPlayers);

            if(
g_iPlayersCount <= iMapMaxPlayers)
            {
                
ArrayPushString(g_arraytempmapsszMap);
            }
        }

        new 
iSize;
        if((
iSize ArraySize(g_arraytempmaps)) > 0)
        {
            
ArrayGetString(g_arraytempmapsrandom(iSize), szMapcharsmax(szMap));
        }

        
ArrayDestroy(g_arraytempmaps);

        if(
iSize 0)
        {
            
server_cmd("changelevel ^"%s^""szMap);
        }
        else
        {
            
server_cmd("mp_timelimit 0.1");
        }
    }

Open file mapsystemppc.txt and add the popular maps with the number of maximum players next to their name, an example file...

Code:
// Will change to de_dust2 if the number of players are 16 and under...
de_dust2 16
// Will change to de_inferno if the number of players are 8 and under...
de_inferno 8

// etc....


Thank you for your help in replying to me

1.8.1
1.9.0
Neither can be compiled
Lihing is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 10-27-2023 , 13:20   Re: Map number of people plug-in request
Reply With Quote #10

add

PHP Code:
#if AMXX_VERSION_NUM > 182
#define client_disconnect client_disconnected
#endif 
__________________
mlibre is offline
Reply



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 14:18.


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