Raised This Month: $ Target: $400
 0% 

Hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-19-2010 , 15:54   Hostname
Reply With Quote #1

which code do i use to recieve hostname? .. I'm a new coder.. I was coding this plugin, and i got stuck here and i dunno what to do...
Code:
#include <amxmodx>
#include <colorchat> 

new const   PLUGIN[ ] = "Welcome messages"
new const  VERSION[ ] = "1.0"
new const  AUTHOR[ ] = "FlyingHorse"

new   prefix[ ] = "[AMXX]^x04"

public plugin_init()
{ 
    register_plugin(PLUGIN, VERSION, AUTHOR)
} 

public welcomemsg(id)
{
    new name[33]
    get_user_name(id, name, 32)
    ColorChat(id, RED, "%s %s, Welcome to (hostname)", prefix, name)
} 

public client_putinserver(id)
{ 
    set_task(10.0, "welcomemsg", id)
}
instead of (hostname) I want it to read the servers hostname, to whatever i change it to.. Instead of having to change the code every time i want to change hostname.

Last edited by FlyingHorse; 05-19-2010 at 16:17.
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-19-2010 , 16:18   Re: Hostname
Reply With Quote #2

PHP Code:
new pcvar_hostname
public plugin_init()
{
    
pcvar_hostname get_cvar_pointer("hostname")
}

public 
welcomemsg()
{
    static 
hostname[64]
    
get_pcvar_string(pcvar_hostnamehostname63)

    new 
name[33]
    
get_user_name(idname32)
    
ColorChat(idRED"%s %s, Welcome to %s"prefixnamehostname)

__________________
Impossible is Nothing
Sylwester is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-19-2010 , 16:32   Re: Hostname
Reply With Quote #3

Thanks dude
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
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 03:38.


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