Checking If Server Variable Not Exists -
K0P - 10.04.2016
Hi,i made a function which automatically adds tag to server hostname if its hosted on ip *,but there is a problem that if the variable "bind" is not in the server.cfg,it adds the server tag in that case too,anyone knows a fix for that?
Код:
if(!strcmp(GetServerIP(), "***.***.***.***", false))
{
SendRconCommand("hostname "HOSTNAME" "HOSTNAME_TAG"");
}
else
{
SendRconCommand("hostname "HOSTNAME"");
}
Re: Checking If Server Variable Not Exists -
K0P - 10.04.2016
Anyone :/
Re: Checking If Server Variable Not Exists -
DavidGravelli - 10.04.2016
Try That forward ChangeHostNameUpdate();
public ChangeHostnameUpdate()
{
SetTimer("hostname",3000,1);
(1000 = 100 second)
return 1;
}
new var = random(4);
switch (var)
{
case 0: SendRconCommand("hostname [Hostname]");
case 1: SendRconCommand("hostname [Hostname]");
case 2: SendRconCommand("hostname [Hostname]");
}
Re: Checking If Server Variable Not Exists -
ayoub001 - 10.04.2016
try this
PHP код:
if(!strcmp(GetServerIP(), "***.***.***.***", false))
{
new hName[100];
strint(hName,HOSTNAME_TAG,sizeof(HOSTNAME));
SendRconCommand("hostname hName");
}
else
{
SendRconCommand("hostname "HOSTNAME"");
}
i don't know if this will work repley if it did
Re: Checking If Server Variable Not Exists -
ayoub001 - 10.04.2016
or you can do
PHP код:
#define HOSTNAME1 "hostname ihfqzfmlqsdjflqhsdfl "
#define HOSTNAME2 "hostname ksdhfklqdhflqkhfkhk [TAAG]"
if(!strcmp(GetServerIP(), "***.***.***.***", false))
{
SendRconCommand(HOSTNAME1);
}
else
{
SendRconCommand(HOSTNAME2);
}
Re: Checking If Server Variable Not Exists -
K0P - 10.04.2016
The tag is working properly,but im asking to remove the tag if the "bind" is not defined in server.cfg
Re: Checking If Server Variable Not Exists -
Threshold - 10.04.2016
pawn Код:
new string[16];
GetConsoleVarAsString("bind", string, sizeof(string));
if(string[0] == EOS)
{
// There is no 'bind' or 'bind' is null.
}
else
{
// There is a 'bind' in server.cfg (or has been set in console)
}
Re: Checking If Server Variable Not Exists -
K0P - 10.04.2016
Quote:
Originally Posted by Threshold
pawn Код:
new string[16]; GetConsoleVarAsString("bind", string, sizeof(string)); if(string[0] == EOS) { // There is no 'bind' or 'bind' is null. } else { // There is a 'bind' in server.cfg (or has been set in console) }
|
Can i use GetServerVarAsString?
Re: Checking If Server Variable Not Exists -
Threshold - 10.04.2016
Depends what version of SA-MP you're using.
https://sampwiki.blast.hk/wiki/GetServerVarAsString
Quote:
This function, as of 0.3.7 R2, is deprecated. Please see GetConsoleVarAsString
|