Raised This Month: $ Target: $400
 0% 

[HL2DM] Difficulties in getting teamplay status


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GAVVVR
Member
Join Date: May 2010
Old 01-31-2014 , 11:19   [HL2DM] Difficulties in getting teamplay status
Reply With Quote #1

Hello. Imagine the situation: server is in tdm mode, then admin changes mp_teamplay to 0 without mapchange (in hl2dm you need to change the map for getting effect, mp_teamplay won't change mode "on the fly"). Now after all of this my plugin is loaded. It wants to know if there is tdm or dm-mode on server. The most obvious solution is getting bool value of mp_teamplay, but in above situation mp_teamplay can't provide correct information.
So i am looking for good method to detect teamplay status. I was thinking about getting server info, which people see if they press "View server info", "Game:" string provides correct information. So my question is: how can i get this string or maybe you can suggest better solution of detecting teamplay status?
Thanks
GAVVVR is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-31-2014 , 11:53   Re: [HL2DM] Difficulties in getting teamplay status
Reply With Quote #2

If you're writing a SourceMod plugin, just store the value of mp_teamplay in OnConfigsExecuted and then check against that variable. Something like this.

PHP Code:
new Handle:g_Cvar_Teamplay;
new 
bool:g_bTeamplay false;

public 
OnPluginStart()
{
    
g_Cvar_Teamplay FindConVar("mp_teamplay");
}

public 
OnConfigsExecuted()
{
    
g_bTeamplay GetConVarBool(g_Cvar_Teamplay);

__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 01-31-2014 at 11:56.
Powerlord is offline
GAVVVR
Member
Join Date: May 2010
Old 01-31-2014 , 12:22   Re: [HL2DM] Difficulties in getting teamplay status
Reply With Quote #3

Thanks for this, but mp_teamplay lies if there was dm-mode on the server and in configs there was mp_teamplay 1 and there was no mapchange yet.
You can say it is very rare situation, but some dumb people in hl2dm can execute tdm match cfg playing 1v1 just because they want to play 20 minutes instead of 15 .
I found GetGameDescription() function. Just compare this string with "Deathmatch"/"Team Deathmatch" and it works
GAVVVR 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 19:30.


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