Module: Map Name Patcher v1.0 [Linux + Windows]

Adding Modules to help with scripting/coding plugins.
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Module: Map Name Patcher v1.0 [Linux + Windows]

Post by Archive-Poster »

MapName Patcher
1.0

Informations

♠ You may change the map name through Patch_MapName native
♠ Maximum length is 128 characters [not sure about the maximum length of the string]

Installation

♠ Upload mapname_patcher_amxx.dll and mapname_patcher_amxx_i386.so in addons/amxmodx/modules
♠ Attach your plugin to AMX Mod X adding line YourPluginName.amxx in addons/amxmodx/configs/plugins.ini

AMX Mod X connection

♠ Example of plugin:

Code: Select all

/* AMX Mod X */
#include < amxmodx >
#include < mapname_patcher >

public plugin_cfg( )
  Patch_MapName( "de_dust2 (Bomb)" );
Attachments
Mapname Patcher Source Code.zip
(270.08 KiB) Downloaded 5 times
mapname_patcher_amxx.dll.zip
(39.94 KiB) Downloaded 3 times
mapname_patcher_amxx_i386.so.zip
(8.91 KiB) Downloaded 2 times
mapname_patcher.inc.zip
(464 Bytes) Downloaded 1 time
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Re: Module: Map Name Patcher v1.0 [Linux + Windows]

Post by Archive-Poster »

Either you download Notepad Plus Plus software and create a new file with UTF-8 without BOM [ANSI as UTF-8] encoding or download the attached file then edit it.

Example:

Code: Select all

#include < amxmodx >
#include < mapname_patcher >

public plugin_cfg( ) {
    new File = fopen( "addons/amxmodx/configs/MapName.ini", "r" );
    if( File != 0 ) {
        static Buffer[ 256 ];
        fgets( File, Buffer, charsmax( Buffer ) );
        fclose( File );
        trim( Buffer );
        Patch_MapName( Buffer );
    }
} 
Attachments
MapName.ini.zip
(203 Bytes) Downloaded 2 times
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Re: Module: Map Name Patcher v1.0 [Linux + Windows]

Post by Archive-Poster »

Cool stuff
I remove the prefix from the map name (de_, cs_, as_, awp_, etc).

Code: Select all

    new szMapName[ 32 ]
    get_mapname( szMapName, charsmax( szMapName ) )
    
    if( containi( szMapName, "_" ) != -1 )
    {
        new szMapPrefix[ 10 ]
        new szMapSufix[ 32 ]
        
        strtok( szMapName, szMapPrefix, charsmax( szMapPrefix ), szMapSufix, charsmax( szMapSufix ), '_' )
        
        Patch_MapName( szMapSufix )        
    } 
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Re: Module: Map Name Patcher v1.0 [Linux + Windows]

Post by Archive-Poster »

Can this change each map name? Because I can only change all map names to the same name
Yes after my post i realized how dumb I was

I made this way

Code: Select all

#include < amxmodx >
#include < mapname_patcher >

public plugin_init()
{
    
    new szMapName[ 32 ]
    get_mapname( szMapName, charsmax( szMapName ) )
    
    if(equali(szMapName,"de_dust2"))
    {
    Patch_MapName( "de_dust2 [FZ]" );
    }
}
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Re: Module: Map Name Patcher v1.0 [Linux + Windows]

Post by Archive-Poster »

small bug

start server

"de_dust" change to "Dust"

restart map - servers crash

because no map "Dust"
Use changelevel %MapName% instead.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest