SA-MP Forums Archive
error 021: symbol already defined: "SendRconCommand" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 021: symbol already defined: "SendRconCommand" (/showthread.php?tid=74538)



error 021: symbol already defined: "SendRconCommand" - Think - 23.04.2009

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);
}



Re: error 021: symbol already defined: "SendRconCommand" - lavamike - 23.04.2009

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.


Re: error 021: symbol already defined: "SendRconCommand" - Donny_k - 23.04.2009

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




Re: error 021: symbol already defined: "SendRconCommand" - Jefff - 23.04.2009

HostName always be 1 :>

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



Re: error 021: symbol already defined: "SendRconCommand" - maij - 24.04.2009

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