AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Current map name edit in "find servers" (https://forums.alliedmods.net/showthread.php?t=332031)

joaokb 04-19-2021 16:14

Current map name edit in "find servers"
 
could someone make a plugin that i can edit the map name in find servers?

example: im playing mirage in my server but in find servers shows de_dust2

like this one, but changing de map name in the list: https://forums.alliedmods.net/showthread.php?t=21484

thx :)

tarsisd2 04-19-2021 17:15

Re: Current map name edit in "find servers"
 
1 Attachment(s)
try this:

PHP Code:

//#define REHLDS_SERVER
new const CONFIG_FILE[] = "fake_maps"

#include <amxmodx>

#if !defined REHLDS_SERVER
    #include <fakemeta>

    #define ALLOC_STRING(%0)         engfunc(EngFunc_AllocString, %0)

    
new Trie:g_tMapNamesg_iGlobalVar_MapName
#else
    #include <reapi>
#endif

public plugin_init()
{
    
register_plugin("Fake Map""0.3""Vaqtincha")
    
register_concmd("set_fakemap""ConCmd_ChangeMapName"ADMIN_CFG"set_fakemap < fake name > or < default >")

    new 
szMapName[32]
    
get_mapname(szMapNamecharsmax(szMapName))

#if !defined REHLDS_SERVER
    
g_tMapNames TrieCreate()

    
TrieSetCell(g_tMapNames"default"ALLOC_STRING(szMapName))

    new 
iGlobalVar is_linux_server() ? -0xC0 0x11320
    g_iGlobalVar_MapName 
engfunc(EngFunc_GetInfoKeyBuffer, -1) + iGlobalVar 0xC
#endif

    
LoadFakeList(szMapName)
}

public 
ConCmd_ChangeMapName(const pPlayer, const level)
{
    if(!(
get_user_flags(pPlayer) & level))
        return 
PLUGIN_HANDLED

    
if(read_argc() != 2)
    {
        
server_print("set_fakemap < fake name > or < default >")
        return 
PLUGIN_HANDLED
    
}

    new 
szMapName[32]
    
read_argv(1szMapNamecharsmax(szMapName))

    
SetMapName(szMapName)

    return 
PLUGIN_HANDLED
}

SetMapName(const szMapName[])
{
#if !defined REHLDS_SERVER
    
new iszNewName
    
// strtolower(szMapName)

    
if(!TrieGetCell(g_tMapNamesszMapNameiszNewName))
    {
        
iszNewName ALLOC_STRING(szMapName)
        
TrieSetCell(g_tMapNamesszMapNameiszNewName)
    }

    
UTIL__PatchMapName(iszNewName)

#else
    
if(equali(szMapName"default")) {
        
rh_reset_mapname()
    }
    else {
        
rh_set_mapname(szMapName)
    }
#endif
}

LoadFakeList(const szCurrentMapName[])
{
    new 
szConfigFile[256], pFile
    
new iLen get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile))
    
formatex(szConfigFile[iLen], charsmax(szConfigFile) - iLen"%s/%s.ini"szConfigFile[iLen], CONFIG_FILE)

    if(!(
pFile fopen(szConfigFile"rt")))
        return

    new 
szBuffer[128], szFakeMapName[128]

    while(!
feof(pFile))
    {
        
fgets(pFileszBuffercharsmax(szBuffer))
        
trim(szBuffer)
    
        if(!
szBuffer[0] || szBuffer[0] == ';' || szBuffer[0] == '#')
            continue
    
        if(
szBuffer[0] == '[')
        {
            
copyc(szFakeMapNamecharsmax(szFakeMapName), szBuffer[1], ']')       
            continue
        }
    
        if(!
szFakeMapName[0])
        {
            
server_print("[FAKE MAP] Error: Invalid config file!")
            break
        }

        if(
equali(szCurrentMapNameszBuffer))
        {
            
server_print("[FAKE MAP] Info: Current map %s set to %s"szCurrentMapNameszFakeMapName)
            
SetMapName(szFakeMapName)
            break
        }
    }
}

// thanks to PRoSToTeM@, good idea.
// -- implemented hack: PRoSToTeM@
// -- by s1lent
stock UTIL__PatchMapName(const iszNewName)
{
    if(
iszNewName) {
        
set_tr2(g_iGlobalVar_MapNameTR_AllSolidiszNewName)
    }


PHP Code:

//#define REHLDS_SERVER 

- uncomment, if you have a ReHLDS server

cvar
PHP Code:

set_fakemap de_dust2 

you can also set different names for diff maps

PHP Code:

FakeMaps configuration file
;[name you want it to be]
name of the maps you want to change

[de_dust2]
de_dust2x2_sneg
de_dust2_snow


[de_inferno]
de_inferno_pro
de_inferno_xmas 


joaokb 04-19-2021 19:08

Re: Current map name edit in "find servers"
 
Quote:

Originally Posted by tarsisd2 (Post 2744546)
try this:

PHP Code:

//#define REHLDS_SERVER
new const CONFIG_FILE[] = "fake_maps"

#include <amxmodx>

#if !defined REHLDS_SERVER
    #include <fakemeta>

    #define ALLOC_STRING(%0)         engfunc(EngFunc_AllocString, %0)

    
new Trie:g_tMapNamesg_iGlobalVar_MapName
#else
    #include <reapi>
#endif

public plugin_init()
{
    
register_plugin("Fake Map""0.3""Vaqtincha")
    
register_concmd("set_fakemap""ConCmd_ChangeMapName"ADMIN_CFG"set_fakemap < fake name > or < default >")

    new 
szMapName[32]
    
get_mapname(szMapNamecharsmax(szMapName))

#if !defined REHLDS_SERVER
    
g_tMapNames TrieCreate()

    
TrieSetCell(g_tMapNames"default"ALLOC_STRING(szMapName))

    new 
iGlobalVar is_linux_server() ? -0xC0 0x11320
    g_iGlobalVar_MapName 
engfunc(EngFunc_GetInfoKeyBuffer, -1) + iGlobalVar 0xC
#endif

    
LoadFakeList(szMapName)
}

public 
ConCmd_ChangeMapName(const pPlayer, const level)
{
    if(!(
get_user_flags(pPlayer) & level))
        return 
PLUGIN_HANDLED

    
if(read_argc() != 2)
    {
        
server_print("set_fakemap < fake name > or < default >")
        return 
PLUGIN_HANDLED
    
}

    new 
szMapName[32]
    
read_argv(1szMapNamecharsmax(szMapName))

    
SetMapName(szMapName)

    return 
PLUGIN_HANDLED
}

SetMapName(const szMapName[])
{
#if !defined REHLDS_SERVER
    
new iszNewName
    
// strtolower(szMapName)

    
if(!TrieGetCell(g_tMapNamesszMapNameiszNewName))
    {
        
iszNewName ALLOC_STRING(szMapName)
        
TrieSetCell(g_tMapNamesszMapNameiszNewName)
    }

    
UTIL__PatchMapName(iszNewName)

#else
    
if(equali(szMapName"default")) {
        
rh_reset_mapname()
    }
    else {
        
rh_set_mapname(szMapName)
    }
#endif
}

LoadFakeList(const szCurrentMapName[])
{
    new 
szConfigFile[256], pFile
    
new iLen get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile))
    
formatex(szConfigFile[iLen], charsmax(szConfigFile) - iLen"%s/%s.ini"szConfigFile[iLen], CONFIG_FILE)

    if(!(
pFile fopen(szConfigFile"rt")))
        return

    new 
szBuffer[128], szFakeMapName[128]

    while(!
feof(pFile))
    {
        
fgets(pFileszBuffercharsmax(szBuffer))
        
trim(szBuffer)
    
        if(!
szBuffer[0] || szBuffer[0] == ';' || szBuffer[0] == '#')
            continue
    
        if(
szBuffer[0] == '[')
        {
            
copyc(szFakeMapNamecharsmax(szFakeMapName), szBuffer[1], ']')       
            continue
        }
    
        if(!
szFakeMapName[0])
        {
            
server_print("[FAKE MAP] Error: Invalid config file!")
            break
        }

        if(
equali(szCurrentMapNameszBuffer))
        {
            
server_print("[FAKE MAP] Info: Current map %s set to %s"szCurrentMapNameszFakeMapName)
            
SetMapName(szFakeMapName)
            break
        }
    }
}

// thanks to PRoSToTeM@, good idea.
// -- implemented hack: PRoSToTeM@
// -- by s1lent
stock UTIL__PatchMapName(const iszNewName)
{
    if(
iszNewName) {
        
set_tr2(g_iGlobalVar_MapNameTR_AllSolidiszNewName)
    }


PHP Code:

//#define REHLDS_SERVER 

- uncomment, if you have a ReHLDS server

cvar
PHP Code:

set_fakemap de_dust2 

you can also set different names for diff maps

PHP Code:

FakeMaps configuration file
;[name you want it to be]
name of the maps you want to change

[de_dust2]
de_dust2x2_sneg
de_dust2_snow


[de_inferno]
de_inferno_pro
de_inferno_xmas 



How can i talk to you in private bro?!

tarsisd2 04-19-2021 20:31

Re: Current map name edit in "find servers"
 
you can send pm, you can also post here

MAJESTIC_SZ 04-19-2021 20:49

Re: Current map name edit in "find servers"
 
Hi.
This is what you need, 100% sure:

https://www.amxx-bg.info/forum/viewt...hp?f=18&t=1780

joaokb 04-20-2021 06:57

Re: Current map name edit in "find servers"
 
Quote:

Originally Posted by MAJESTIC_SZ (Post 2744567)
Hi.
This is what you need, 100% sure:

https://www.amxx-bg.info/forum/viewt...hp?f=18&t=1780

thx so much bro, there are some angels in this forum :wink::3

DruGzOG 04-20-2021 09:45

Re: Current map name edit in "find servers"
 
This shouldn't even be allowed here. Goes against Valve's Policy of Truth.

joaokb 04-20-2021 13:16

Re: Current map name edit in "find servers"
 
Quote:

Originally Posted by DruGzOG (Post 2744616)
This shouldn't even be allowed here. Goes against Valve's Policy of Truth.

why?

DruGzOG 04-20-2021 17:02

Re: Current map name edit in "find servers"
 
https://support.steampowered.com/kb_...FGJ-3513#truth

tarsisd2 04-21-2021 00:10

Re: Current map name edit in "find servers"
 
Quote:

Originally Posted by DruGzOG (Post 2744660)

pretty sure that page is meant for Team Fortress 2


All times are GMT -4. The time now is 03:35.

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