AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   wierd problem with FM_GetGameDescription (https://forums.alliedmods.net/showthread.php?t=308682)

iceeedr 06-29-2018 21:51

wierd problem with FM_GetGameDescription
 
Hello friends, once again I ask for a light for a strange problem, In the example below when I try to change the name of the game to the name of the mod I am receiving an empty string, however if I debug the message with a %s, I get perfectly string, what's wrong?


PHP Code:

register_forward(FM_GetGameDescription"GameDesc")

public 
GameDesc() 

    static 
szMod[20]
    
get_gamemode(szModcharsmax(szMod))
    
forward_return(FMV_STRINGfmt("[%s]"szMod))
    return 
FMRES_SUPERCEDE
}

get_gamemode(szBuffer[], iLen)
{
    if(
something)
             
formatex(szBufferiLen"something")
        
    else if(
any)    
          
formatex(szBufferiLen"any")



klippy 06-30-2018 02:05

Re: wierd problem with FM_GetGameDescription
 
Try with FMRES_OVERRIDE instead.

iceeedr 06-30-2018 11:36

Re: wierd problem with FM_GetGameDescription
 
Quote:

Originally Posted by KliPPy (Post 2599999)
Try with FMRES_OVERRIDE instead.

KliPPy, thanks for the answer, below the result. Any idea?

With SUPERCEDE
https://ibb.co/e3jWHJ


With OVERRIDE
https://ibb.co/ds9sPy

iceeedr 07-01-2018 08:11

Re: wierd problem with FM_GetGameDescription
 
Still no results, no one going through this?

CrazY. 07-01-2018 14:12

Re: wierd problem with FM_GetGameDescription
 
From zp50_serverbrowser_info

Code:
/*================================================================================         --------------------------------     -*- [ZP] Server Broswer Info -*-     --------------------------------         This plugin is part of Zombie Plague Mod and is distributed under the     terms of the GNU General Public License. Check ZP_ReadMe.txt for details.     ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <zp50_core> new g_ModName[64] public plugin_init() {     register_plugin("[ZP] Server Browser Info", ZP_VERSION_STRING, "ZP Dev Team")         register_forward(FM_GetGameDescription, "fw_GetGameDescription")     formatex(g_ModName, charsmax(g_ModName), "Zombie Plague %s", ZP_VERSION_STR_LONG) } // Forward Get Game Description public fw_GetGameDescription() {     // Return the mod name so it can be easily identified     forward_return(FMV_STRING, g_ModName)         return FMRES_SUPERCEDE; }

iceeedr 07-01-2018 14:42

Re: wierd problem with FM_GetGameDescription
 
Quote:

Originally Posted by CrazY. (Post 2600359)
From zp50_serverbrowser_info

Code:
/*================================================================================         --------------------------------     -*- [ZP] Server Broswer Info -*-     --------------------------------         This plugin is part of Zombie Plague Mod and is distributed under the     terms of the GNU General Public License. Check ZP_ReadMe.txt for details.     ================================================================================*/ #include <amxmodx> #include <fakemeta> #include <zp50_core> new g_ModName[64] public plugin_init() {     register_plugin("[ZP] Server Browser Info", ZP_VERSION_STRING, "ZP Dev Team")         register_forward(FM_GetGameDescription, "fw_GetGameDescription")     formatex(g_ModName, charsmax(g_ModName), "Zombie Plague %s", ZP_VERSION_STR_LONG) } // Forward Get Game Description public fw_GetGameDescription() {     // Return the mod name so it can be easily identified     forward_return(FMV_STRING, g_ModName)         return FMRES_SUPERCEDE; }


Exactly as I do, the difference is that I format the string with "fmv" from amxx 1.8.3. any other idea of ​​what it might be?

CrazY. 07-01-2018 15:04

Re: wierd problem with FM_GetGameDescription
 
Post full code, otherwise we can't help you.

iceeedr 07-01-2018 15:08

Re: wierd problem with FM_GetGameDescription
 
I post exactly what I tried to do, with that code if I make a debug I receive a string like I format, but when tried to use the same string on the gamedescription stay blank

Ghosted 07-01-2018 16:03

Re: wierd problem with FM_GetGameDescription
 
Quote:

Originally Posted by iceeedr (Post 2600378)
I post exactly what I tried to do, with that code if I make a debug I receive a string like I format, but when tried to use the same string on the gamedescription stay blank

Try that one posted by crazy.

iceeedr 07-02-2018 14:06

Re: wierd problem with FM_GetGameDescription
 
Quote:

Originally Posted by Ghosted (Post 2600398)
Try that one posted by crazy.

It's the same as mine, but okay! Tested and disapproved, any ideas?

PHP Code:

register_forward(FM_GetGameDescription"GameDesc")

get_mode(szBuffer[], iLen)
{
    if(
GameItsUp))
    
formatex(szBufferiLen"Load")
}
public 
GameDesc() 

    static 
szMod[20], szName[20]
    
get_mode(szModcharsmax(szMod))
    
formatex(szNamecharsmax(szName), "[%s]"szMod)
    
forward_return(FMV_STRINGszName// here I received a blank gamename "Load"
    
return FMRES_SUPERCEDE
}

public 
EventNewRnd()
{
    
GameItsUp true
    
static szMod[20]
    
get_mode(szModcharsmax(szMod))
    
    
CC_SendMatched(0RED"%s"szMod// here I received a perfectly string 




All times are GMT -4. The time now is 12:50.

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