Raised This Month: $ Target: $400
 0% 

Getting the hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 02-27-2009 , 09:49   Getting the hostname
Reply With Quote #1

Been having a little trouble with getting the hostname and displaying it in chat. More specifically it seems to display differently in different mods:

HL2DM appends an '=' to the front of the hostname
TF2 doesn't
L4D just displays an '=' without displaying the hostname

I'm using an old bit of code I found somewhere:

PHP Code:
public Action:Command_Host(clientargs
{

        new 
String:hostname[128];
        new 
Handle:hhost;
    
        
hhost FindConVar("hostname");
        
GetConVarString(hhost,hostname,sizeof(hostname));

        
PrintToChat(client"\x04%s"hhost);

Not sure if this is my problem or differneces between mods. Also the hostname displays in the mods default colour, although the '=', when displayed, is the right colour.
Nomarky is offline
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 02-27-2009 , 16:11   Re: Getting the hostname
Reply With Quote #2

Sorted, used this:

PHP Code:
//Find server name
new Handle:convar FindConVar("hostname");

decl String:ServerName[64];
GetConVarStringconvarServerNamesizeof(ServerName)); 
Nomarky 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 13:48.


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