AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Game Description (https://forums.alliedmods.net/showthread.php?t=252043)

spag 11-24-2014 09:53

Game Description
 
How get current (Game Description) ?

Because i want do one check like this one:

Code:

new curr_GD;

if (curr_GD == "Zombie")
{
      my code;
}


NiHiLaNTh 11-24-2014 10:01

Re: Game Description
 
Code:

new gameDesc[32];
dllfunc(DLLFunc_GetGameDescription, gameDesc);

if (equal(gameDesc, "Zombie"))
{
            ...your code...
}


spag 11-24-2014 10:21

Re: Game Description
 
Nope, not working.. My code:

Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN        "GameDescription"
#define VERSION        "1.0"
#define AUTHOR        "-"

#define GAME_NAME        "Zombie"

new gameDesc[32];

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR);
       
        register_forward(FM_GetGameDescription, "GameDesc");
       
        register_clcmd("say /gd", "cmd");
       
        dllfunc(DLLFunc_GetGameDescription, gameDesc);
}

public cmd(id)
{
        if (equal(gameDesc, "Zombie"))
                client_print(id, print_chat, "It's work!");
        else
                client_print(id, print_chat, "Someting wrong.. Current GameDescription is: %s", gameDesc);
}

public GameDesc()
{
        forward_return(FMV_STRING, GAME_NAME);
        return FMRES_SUPERCEDE;
}


baneado 11-24-2014 15:54

Re: Game Description
 
put the dllfunc inside cmd function

spag 11-24-2014 16:54

Re: Game Description
 
Quote:

Originally Posted by baneado (Post 2227920)
put the dllfunc inside cmd function

New problem, i got mod name Counter-Strike. I shoud get Zombie, because i change it, in servers table mod name is Zombie... Mmm, maybe somebody have any ideas?

HamletEagle 11-25-2014 08:52

Re: Game Description
 
Quote:

Originally Posted by spag (Post 2227930)
New problem, i got mod name Counter-Strike. I shoud get Zombie, because i change it, in servers table mod name is Zombie... Mmm, maybe somebody have any ideas?

Do you want the hostname ?

WildCard65 11-25-2014 09:11

Re: Game Description
 
Hostname is the name people see for "Server Name", Game description is the game's name itself(Like Team Fortress 2 for example).

spag 11-25-2014 10:11

Re: Game Description
 
I mean that --- > [IMG]http://s12.************/uco5gkabh/123.png[/IMG]

Arkshine 11-25-2014 10:35

Re: Game Description
 
Retrieving game description can't work because such description is hardcoded in game dll. Meaning like:

Code:

const char *GetGameDescription()
{
    return "Condition zero";
}

When you hook FM_GetGameDescription, you just change the value in memory.
When you call DLLFunc_GetGameDescription, you basically retrieve string by calling GetGameDescription() function directly and not the memory you altered.

On a side note, trying to get the description is now pointless, since you can change the description only at server start.


All times are GMT -4. The time now is 17:29.

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