Raised This Month: $47 Target: $400
 11% 

Solved Exclude multiple map OnMapEnd()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oylsister
Senior Member
Join Date: Aug 2019
Location: KhonKaen, Thailand
Old 04-15-2021 , 09:53   Exclude multiple map OnMapEnd()
Reply With Quote #1

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;
    }

__________________

Last edited by Oylsister; 04-16-2021 at 02:08.
Oylsister is offline
Oylsister
Senior Member
Join Date: Aug 2019
Location: KhonKaen, Thailand
Old 04-16-2021 , 02:05   Re: Exclude multiple map OnMapEnd()
Reply With Quote #2

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
__________________
Oylsister is offline
Reply


Thread Tools
Display Modes

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 19:21.


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