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

[CS:GO] Map Deleter


Post New Thread Reply   
 
Thread Tools Display Modes
Author
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Plugin ID:
6959
Plugin Version:
1.1
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    This plugin deletes desired maps when your server boots
    Old 03-01-2020 , 13:05   [CS:GO] Map Deleter
    Reply With Quote #1

    Map Deleter

    by SpirT



    What is this?
    A Map Deleter. This allow you to AUTO-DELETE any map you want from the folder 'gamemode_folder/maps/' folder when your server boots.

    Requirements
    - SourceMod Installed on your server (plugin was tested on 1.10 build 6482)
    - MetaMod Installed on your server (plugin was tested on 1.9 build 971)

    Installation
    • Upload all files to your server
    • Restart your server / change map / type this command in your server console: 'sm plugins reload spirt_mapdelete'
    • Config file is automatically created on 'csgo/cfg/SpirT/spirt.mapdelete.cfg'
    • Add a file of a map per line for example 'de_dust2.bsp' or 'de_dust2.nav' without the ''

    ToDo List
    • Nothing for now

    Releases
    -------------
    1.1:
    -> Added a config file to delete the desired maps
    -> Deleted all existing ConVars and added one to enable / disable Map Delete Function
    -> Compiled with version 1.10.0 build 6482
    -------------
    1.0.0:
    -> Plugin Release
    -------------

    For any issue or bug, reply to the post or contact me on steam.
    Attached Files
    File Type: zip MapDeleter1.0.zip (15.9 KB, 222 views)
    File Type: sp Get Plugin or Get Source (spirt_mapdelete.sp - 346 views - 2.0 KB)
    File Type: zip MapDeleter1.1.zip (6.7 KB, 216 views)
    __________________

    Last edited by SpirT; 04-23-2020 at 13:23. Reason: New Update
    SpirT is offline
    Groven
    AlliedModders Donor
    Join Date: Apr 2011
    Location: Sweden
    Old 03-01-2020 , 13:26   Re: [CS:GO] Map Deleter
    Reply With Quote #2

    Thanks
    __________________
    Groven is offline
    zwolofmeister
    Member
    Join Date: Aug 2018
    Old 03-01-2020 , 17:47   Re: [CS:GO] Map Deleter
    Reply With Quote #3

    bro I dont wanna be that guy, but this is hoooooooooooorrriiibleeeee, why not just make a loop? instead of 1286 lines ????????????????
    zwolofmeister is offline
    stickz
    Senior Member
    Join Date: Oct 2012
    Location: Ontario, Canada
    Old 03-01-2020 , 22:50   Re: [CS:GO] Map Deleter
    Reply With Quote #4

    This is how to create a plugin using arrays. It's only 150 lines and does the same thing as your 1250 lines.

    Code:
    #include <sourcemod>
    
    #pragma newdecls required
    
    #define CSGO_MAP_COUNT 54
    
    char csgoMapName[CSGO_MAP_COUNT][] = {
    	"ar_baggage",
    	"ar_dizzy",
    	"ar_lunacy",
    	"ar_monastery",
    	"ar_shoots",
    	"coop_kasbah",
    	"cs_agency",
    	"cs_assault",
    	"cs_downtown",
    	"cs_insertion",
    	"cs_italy",
    	"cs_militia",
    	"cs_motel",
    	"cs_office",
    	"cs_rush",
    	"cs_siege",
    	"cs_thunder",
    	"de_ali",
    	"de_aztec",
    	"de_bank",
    	"de_blackgold",
    	"de_breach",
    	"de_cache",
    	"de_canals",
    	"de_cbble",
    	"de_chinatown",
    	"de_dust",
    	"de_dust2",
    	"de_favela",
    	"de_gwalior",
    	"de_inferno",
    	"de_lake",
    	"de_mirage",
    	"de_mist",
    	"de_nuke",
    	"de_overgrown",
    	"de_overpass",
    	"de_ruins",
    	"de_safehouse",
    	"de_seaside",
    	"de_shortdust",
    	"de_shortnuke",
    	"de_shorttrain",
    	"de_stmarc",
    	"de_studio",
    	"de_sugarcane",
    	"de_train",
    	"de_vertigo",
    	"dz_blacksite",
    	"dz_junglety",
    	"dz_sirocco",
    	"gd_cbble",
    	"gd_rialto",
    	"training1"
    };
    
    ConVar g_DeleteMap[CSGO_MAP_COUNT];
    
    public Plugin myinfo = 
    {
    	name = "[SpirT] Map Delete",
    	author = "SpirT",
    	description = "Deletes the default CS:GO Maps after a steam update. Plugin will check for that maps when it loads",
    	version = "2.0",
    	url = ""
    };
    
    public void OnPluginStart()
    {	
    	for (int i = 0; i < CSGO_MAP_COUNT; i++)
    	{
    		// Create cvar name
    		char cvarName[32];
    		Format(cvarName, sizeof(cvarName), "spirt_mapdel_%s", csgoMapName[i]);
    		
    		// Create cvar description
    		char cvarDesc[64];
    		Format(cvarDesc, sizeof(cvarDesc), "Deletes all %s files", csgoMapName[i]);
    		
    		// Create cvar from name and description. Set bool min and max values
    		g_DeleteMap[i] = CreateConVar(cvarName, "1", cvarDesc, _, true, 0.0, true, 1.0);
    	}
    	
    	AutoExecConfig(true, "spirt.mapdelete", "SpirT");
    }
    
    public void OnMapStart()
    {
    	DeleteAllMaps();
    	return;
    }
    
    void DeleteAllMaps()
    {
    	char fileExt[3][] = {
    		"bsp",
    		"nav",
    		"jpg"
    	};
    		
    	for (int i = 0; i < CSGO_MAP_COUNT; i++)
    	{		
    		if (g_DeleteMap[i].BoolValue)
    		{		
    			for (int f = 0; f < 3; f++)
    			{
    				// Create the file name string
    				char fileName[32];
    				Format(fileName, sizeof(fileName), "maps/%s.%s", csgoMapName[i], fileExt[f]);
    				
    				// Delete the file if it exists
    				if (FileExists(fileName))
    					DeleteFile(fileName);
    			}
    		}
    	}
    }

    Last edited by stickz; 03-01-2020 at 22:52.
    stickz is offline
    SpirT
    Senior Member
    Join Date: Sep 2018
    Location: Portugal
    Old 03-02-2020 , 06:17   Re: [CS:GO] Map Deleter
    Reply With Quote #5

    Quote:
    Originally Posted by stickz View Post
    This is how to create a plugin using arrays. It's only 150 lines and does the same thing as your 1250 lines.

    Code:
    #include <sourcemod>
    
    #pragma newdecls required
    
    #define CSGO_MAP_COUNT 54
    
    char csgoMapName[CSGO_MAP_COUNT][] = {
    	"ar_baggage",
    	"ar_dizzy",
    	"ar_lunacy",
    	"ar_monastery",
    	"ar_shoots",
    	"coop_kasbah",
    	"cs_agency",
    	"cs_assault",
    	"cs_downtown",
    	"cs_insertion",
    	"cs_italy",
    	"cs_militia",
    	"cs_motel",
    	"cs_office",
    	"cs_rush",
    	"cs_siege",
    	"cs_thunder",
    	"de_ali",
    	"de_aztec",
    	"de_bank",
    	"de_blackgold",
    	"de_breach",
    	"de_cache",
    	"de_canals",
    	"de_cbble",
    	"de_chinatown",
    	"de_dust",
    	"de_dust2",
    	"de_favela",
    	"de_gwalior",
    	"de_inferno",
    	"de_lake",
    	"de_mirage",
    	"de_mist",
    	"de_nuke",
    	"de_overgrown",
    	"de_overpass",
    	"de_ruins",
    	"de_safehouse",
    	"de_seaside",
    	"de_shortdust",
    	"de_shortnuke",
    	"de_shorttrain",
    	"de_stmarc",
    	"de_studio",
    	"de_sugarcane",
    	"de_train",
    	"de_vertigo",
    	"dz_blacksite",
    	"dz_junglety",
    	"dz_sirocco",
    	"gd_cbble",
    	"gd_rialto",
    	"training1"
    };
    
    ConVar g_DeleteMap[CSGO_MAP_COUNT];
    
    public Plugin myinfo = 
    {
    	name = "[SpirT] Map Delete",
    	author = "SpirT",
    	description = "Deletes the default CS:GO Maps after a steam update. Plugin will check for that maps when it loads",
    	version = "2.0",
    	url = ""
    };
    
    public void OnPluginStart()
    {	
    	for (int i = 0; i < CSGO_MAP_COUNT; i++)
    	{
    		// Create cvar name
    		char cvarName[32];
    		Format(cvarName, sizeof(cvarName), "spirt_mapdel_%s", csgoMapName[i]);
    		
    		// Create cvar description
    		char cvarDesc[64];
    		Format(cvarDesc, sizeof(cvarDesc), "Deletes all %s files", csgoMapName[i]);
    		
    		// Create cvar from name and description. Set bool min and max values
    		g_DeleteMap[i] = CreateConVar(cvarName, "1", cvarDesc, _, true, 0.0, true, 1.0);
    	}
    	
    	AutoExecConfig(true, "spirt.mapdelete", "SpirT");
    }
    
    public void OnMapStart()
    {
    	DeleteAllMaps();
    	return;
    }
    
    void DeleteAllMaps()
    {
    	char fileExt[3][] = {
    		"bsp",
    		"nav",
    		"jpg"
    	};
    		
    	for (int i = 0; i < CSGO_MAP_COUNT; i++)
    	{		
    		if (g_DeleteMap[i].BoolValue)
    		{		
    			for (int f = 0; f < 3; f++)
    			{
    				// Create the file name string
    				char fileName[32];
    				Format(fileName, sizeof(fileName), "maps/%s.%s", csgoMapName[i], fileExt[f]);
    				
    				// Delete the file if it exists
    				if (FileExists(fileName))
    					DeleteFile(fileName);
    			}
    		}
    	}
    }
    Thanks, I will update it to that code and credit you.

    Best Regards,

    SpirT.
    __________________
    SpirT is offline
    Ilusion9
    Veteran Member
    Join Date: Jun 2018
    Location: Romania
    Old 03-02-2020 , 06:36   Re: [CS:GO] Map Deleter
    Reply With Quote #6

    Check if the current map is not in that list. Create config option where users can put their maps name to be removed.
    __________________
    Ilusion9 is offline
    SpirT
    Senior Member
    Join Date: Sep 2018
    Location: Portugal
    Old 03-02-2020 , 16:42   Re: [CS:GO] Map Deleter
    Reply With Quote #7

    Quote:
    Originally Posted by Ilusion9 View Post
    Check if the current map is not in that list. Create config option where users can put their maps name to be removed.
    Added that to ToDo list 😁.
    __________________
    SpirT is offline
    Ilusion9
    Veteran Member
    Join Date: Jun 2018
    Location: Romania
    Old 03-02-2020 , 17:11   Re: [CS:GO] Map Deleter
    Reply With Quote #8

    Edited.
    See my post with github link.
    __________________

    Last edited by Ilusion9; 03-04-2020 at 03:37.
    Ilusion9 is offline
    SpirT
    Senior Member
    Join Date: Sep 2018
    Location: Portugal
    Old 03-03-2020 , 17:24   Re: [CS:GO] Map Deleter
    Reply With Quote #9

    Quote:
    Originally Posted by Ilusion9 View Post
    Put delete_maps in configs.
    Thanks, I'll atatch those later to the main post and credit u. Thanks one more time
    __________________
    SpirT is offline
    Ilusion9
    Veteran Member
    Join Date: Jun 2018
    Location: Romania
    Old 03-04-2020 , 03:23   Re: [CS:GO] Map Deleter
    Reply With Quote #10

    I made a github repository. Users can delete maps and configs.
    https://github.com/Ilusion9/delete-files-sm

    Your plugin idea was good, but the code is ugly ...
    __________________
    Ilusion9 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 15:15.


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