AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Exclude multiple map OnMapEnd() (https://forums.alliedmods.net/showthread.php?t=331952)

Oylsister 04-15-2021 09:53

Exclude multiple map OnMapEnd()
 
Hi I recently tried to write a plugin that could exclude a multiple map after the map end. The idea is to exclude the map inorder to prevent player nominate the same map with different version which happened on Zombie Escape server.
I kind the stuck on the making kv stuff and to proceed on the map end here.

I used this mapchooser-extended plugin btw https://gogs.botox.bz/CSSZombieEscap...ooser_extended

Code:

"groupcooldown"
{
       
        "tyranny"
        {
                // if we find map that have the exactly the same name on config, on map end make every map in the same section "tyranny" get excluded from the mapchooser
                "ze_tyranny_v5_go3" {}
                "ze_tyranny2_v1_csgo2" {}
        }
        "ff"
        {
                "ff" {}
                "ff2" {}
        }
}

PHP Code:

#include <sourcemod>
#include <mapchooser>
#include <mapchooser_extended>
#include <nextmap>
#include <sdktools>
#include <multicolors>

#pragma newdecls required

enum struct MapData
{
    
char data_mapname[PLATFORM_MAX_PATH];
    
char data_mapgroupname[64];
    
    
int data_total;
}

MapData g_mapdata;

char sConfig[PLATFORM_MAX_PATH];

public 
Plugin myinfo =
{
    
name "MapChooser Extended Group Cooldown",
    
author "Oylsister",
    
description "Set a cooldown for every map that in the same group",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_mapgroup"CheckMapGroupName);
    
RegConsoleCmd("sm_getcooldown"CheckMapCooldown);
}

public 
void OnMapStart()
{
    
BuildPath(Path_SMsConfigsizeof(sConfig), "configs/mapchooser_extended_group.cfg");
    
KeyValues kv CreateKeyValues("groupcooldown");
    
    
char mapgroup[64];
    
    
FileToKeyValues(kvsConfig);
    
    if(
KvGotoFirstSubKey(kv))
    {
        do
        {
            
KvGetSectionName(kvmapgroupsizeof(mapgroup));
            if(
KvGotoFirstSubKey(kvfalse))
            {
                do
                {
                    
FormatEx(g_mapdata.data_mapgroupname64"%s"mapgroup); 
                    
KvGetSectionName(kvg_mapdata.data_mapnamePLATFORM_MAX_PATH);
                    
g_mapdata.data_total++;
                } 
                while 
KvGotoFirstSubKey(kvfalse);
                
                
KvGoBack(kv);
            }
        } while (
KvGotoNextKey(kv));
    }
}

public 
void OnMapEnd()
{
    for
}

public 
Action CheckMapGroupName(int clientint args)
{
    if(
args 1)
    {
        
CPrintToChat(client"\x04[MCE]\x01 Usage: sm_mapgroup <mapname>");
        return 
Plugin_Handled;
    }
    
    
char mapname[PLATFORM_MAX_PATH];
    
GetCmdArg(1mapnamesizeof(mapname));
    
    if(
StrEqual(mapnameg_mapdata.data_mapnamefalse))
    {
        
CPrintToChat(client"\x04[MCE]\x01 %s Group Map: %s"g_mapdata.data_mapnameg_mapdata.data_mapgroupname);
        return 
Plugin_Handled;
    }
    
    else
    {
        
CPrintToChat(client"\x04[MCE]\x01 The map doesn't has a group");
        return 
Plugin_Handled;
    }
}

public 
Action CheckMapCooldown(int clientint args)
{
    if(
args 1)
    {
        
CPrintToChat(client"\x04[MCE]\x01 Usage: sm_mapgroup <mapname>");
        return 
Plugin_Handled;
    }
    
    
char mapname[PLATFORM_MAX_PATH];
    
GetCmdArg(1mapnamesizeof(mapname));
    
    
int iCooldown GetMapCooldown(mapname);
    
    if(
StrEqual(mapnameg_mapdata.data_mapnamefalse))
    {
        
CPrintToChat(client"\x04[MCE]\x01 %s Cooldown: %d"g_mapdata.data_mapnameg_mapdata.data_cooldown);
        return 
Plugin_Handled;
    }
    
    else
    {
        
CPrintToChat(client"\x04[MCE]\x01 %s Cooldown: %d (No-Group)"mapnameiCooldown);
        return 
Plugin_Handled;
    }



Oylsister 04-16-2021 02:05

Re: Exclude multiple map OnMapEnd()
 
Instead of making of new plugin I managed to made it work on Mapchooser-Extended core. Thanks to DarkerZ[RUS], if you would like to check out here : https://github.com/oylsister/mapchooser-extended


All times are GMT -4. The time now is 07:56.

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