error 021: symbol already defined: "SendRconCommand"
#1

error 021: symbol already defined: "SendRconCommand"

ok i changed everything so i hope it will be easier if people can have a look at this

pawn Код:
stock ChangeHostName()
{
    new HostName = 0
    HostName++;
    if(HostName > 2)
    {
      HostName = 0;
    }
    switch(HostName)
    {
        case 0: format(string, sizeof(string), "hostname %s", HOSTNAME1);
        case 1: format(string, sizeof(string), "hostname %s", HOSTNAME2);
        case 2: format(string, sizeof(string), "hostname %s", HOSTNAME3);
    }
    SendRconCommand(string);
}
Reply
#2

Quote:
Originally Posted by Pandabeer1337
error 021: symbol already defined: "SendRconCommand"

ok i changed everything so i hope it will be easier if people can have a look at this
This might fix it but i'm not sure..

pawn Код:
stock ChangeHostName()
{
  new HostName = 0
  HostName++;
  if(HostName > 2)
  {
    HostName = 0;
  }
  switch(HostName)
  {
    case 0:
    {
      format(string, sizeof(string), "hostname %s", HOSTNAME1);
      SendRconCommand(string);
    }

    case 1:
    {
      format(string, sizeof(string), "hostname %s", HOSTNAME2);
      SendRconCommand(string);
    }

    case 2:
    {
      format(string, sizeof(string), "hostname %s", HOSTNAME3);
      SendRconCommand(string);
    }
  }
}
Are you sure that error is referring to this piece of code? It might be referring to a different line.
Reply
#3

pawn Код:
new HostName = 0 // ; << missing

Reply
#4

HostName always be 1 :>

at the top this
Код:
new HostName = 0;
Reply
#5

[pawno]stock ChangeHostName()
{
new HostName = 0;//note it always stays zero here // and u forgot to put the end piece of code ;
HostName++;//it always sets the hostname value + 1
if(HostName > 2)//if hostname is 2, which it never becomes it sets the value = zero
{
HostName = 0;
}
switch(HostName)//the number mostlikely is the case
{
case 0: format(string, sizeof(string), "hostname %s", HOSTNAME1);//i guess these are defines.
case 1: format(string, sizeof(string), "hostname %s", HOSTNAME2);//the value that always get picked
case 2: format(string, sizeof(string), "hostname %s", HOSTNAME3);//never gets picked, same goes for case 0
}
SendRconCommand(string);//its not a problem with this code, but the rest. since i expect u to use a_samp. it is already defined, and therefore u cannot use that same functionname for anything else.
return HostName;
}[/pawno]

also u forgot return.
the problem though mostlikely lies within a forward or variable.
not within this piece of code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)