Raised This Month: $ Target: $400
 0% 

Game Description


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spag
Junior Member
Join Date: Feb 2013
Old 11-24-2014 , 09:53   Game Description
Reply With Quote #1

How get current (Game Description) ?

Because i want do one check like this one:

Code:
new curr_GD;

if (curr_GD == "Zombie")
{
       my code;
}
spag is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 11-24-2014 , 10:01   Re: Game Description
Reply With Quote #2

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

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


Last edited by NiHiLaNTh; 11-24-2014 at 10:01.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
spag
Junior Member
Join Date: Feb 2013
Old 11-24-2014 , 10:21   Re: Game Description
Reply With Quote #3

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;
}
spag is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 11-24-2014 , 15:54   Re: Game Description
Reply With Quote #4

put the dllfunc inside cmd function

Last edited by baneado; 11-24-2014 at 15:54.
baneado is offline
spag
Junior Member
Join Date: Feb 2013
Old 11-24-2014 , 16:54   Re: Game Description
Reply With Quote #5

Quote:
Originally Posted by baneado View Post
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?

Last edited by spag; 11-24-2014 at 17:17.
spag is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-25-2014 , 08:52   Re: Game Description
Reply With Quote #6

Quote:
Originally Posted by spag View Post
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 ?
__________________
HamletEagle is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-25-2014 , 09:11   Re: Game Description
Reply With Quote #7

Hostname is the name people see for "Server Name", Game description is the game's name itself(Like Team Fortress 2 for example).
__________________
WildCard65 is offline
spag
Junior Member
Join Date: Feb 2013
Old 11-25-2014 , 10:11   Re: Game Description
Reply With Quote #8

I mean that --- > [IMG]http://s12.************/uco5gkabh/123.png[/IMG]
spag is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-25-2014 , 10:35   Re: Game Description
Reply With Quote #9

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.
__________________

Last edited by Arkshine; 11-25-2014 at 10:37.
Arkshine 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 17:29.


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