AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hostname (https://forums.alliedmods.net/showthread.php?t=127327)

FlyingHorse 05-19-2010 15:54

Hostname
 
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.

Sylwester 05-19-2010 16:18

Re: Hostname
 
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)



FlyingHorse 05-19-2010 16:32

Re: Hostname
 
Thanks dude


All times are GMT -4. The time now is 03:38.

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