AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to get server name ? (https://forums.alliedmods.net/showthread.php?t=25065)

expolit 03-07-2006 03:38

How to get server name ?
 
How to get server name ?
Could you show some example of code ?
//Sorry for my bad english...

Xanimos 03-07-2006 06:28

Code:
new HostName[32] get_cvar_string("hostname" , HostName, 31)

Charr 03-07-2006 14:19

Would get_user_name with an index of 0 also work?

Xanimos 03-07-2006 15:47

No. That uses a different system of retrieving names.

PM 03-07-2006 15:58

Actually, the get_user_name native returns the string value of the hostname cvar if you pass an index which is lower than 1 or greater than 32.

Code:

(index < 1 || index > gpGlobals->maxClients) ? hostname->string : g_players[index].name.c_str()
from here (search for get_user_name)

Xanimos 03-07-2006 16:10

hmmm....didn't know that. I would have figured you would have just recieved a native error.


All times are GMT -4. The time now is 20:23.

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