Raised This Month: $ Target: $400
 0% 

Hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Artifact
Veteran Member
Join Date: Jul 2010
Old 06-25-2011 , 09:17   Hostname
Reply With Quote #1

How to include hostname??

Example:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connect(id)
{
    
client_print(idprint_chat"Welcome to hostname")
    return 
PLUGIN_HANDLED

__________________
Artifact is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-25-2011 , 09:19   Re: Hostname
Reply With Quote #2

PHP Code:
new g_cHostName;

public 
plugin_init()
    
g_cHostName get_cvar_pointer("hostname");


public 
Something()
{
    new 
szHostname[35];
    
get_pcvar_string(g_cHostnameszHostnamecharsmax(szHostname));
    
client_print(0print_chat"Welcome to %s"szHostname);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 07-11-2011 at 06:33.
drekes is offline
Send a message via MSN to drekes
Artifact
Veteran Member
Join Date: Jul 2010
Old 07-11-2011 , 04:23   Re: Hostname
Reply With Quote #3

PHP Code:
get_pcvar_pointer 
???

I know for get_cvar_pointer... But this is not exist...
Code:
Error: Undefined symbol "get_pcvar_pointer" on line 17
__________________
Artifact is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 07-11-2011 , 04:47   Re: Hostname
Reply With Quote #4

It should be
Code:
get_cvar_pointer  

__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 07-11-2011 , 05:50   Re: Hostname
Reply With Quote #5

Quote:
Originally Posted by NiHiLaNTh View Post
It should be
Code:
get_cvar_pointer  

no it shouldnt, get_cvar_pointer doesent exist, since get_cvar_* and set_cvar_* dont use pointers
jimaway is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-11-2011 , 05:54   Re: Hostname
Reply With Quote #6

Quote:
Originally Posted by BodyBuilder View Post
PHP Code:
new hostname[64]
get_cvar_string("hostname",hostname,63)
client_print(idprint_chat"Welcome to %s",hostname
Pcvars are much faster and should be used if the cvar is to be used more than once for the map.

Quote:
Originally Posted by jimaway View Post
no it shouldnt, get_cvar_pointer doesent exist, since get_cvar_* and set_cvar_* dont use pointers
Actually, it does exist.
It is used to get an existing cvar's pointer.
You can also get a cvar's pointer by registering it.
Cvar pointers (Pcvars) are much faster than normal cvars because it removes the cvar pointer lookup when using the functions.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 07-11-2011, 05:15
BodyBuilder
This message has been deleted by BodyBuilder.
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-11-2011 , 06:34   Re: Hostname
Reply With Quote #8

Fixed my code above.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply


Thread Tools
Display Modes

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 23:29.


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