SA-MP Forums Archive
26 errors. - 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: 26 errors. (/showthread.php?tid=137762)



26 errors. - iLcke - 30.03.2010

Код:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
new tmpcar = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
return 1;
}
if (gTeam[playerid] != 2 || 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not a police officer or medic!");
return 1;
}
if(!IsACopCar(tmpcar) || !IsAnAmbulance(tmpcar))
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not in a service vehicle");
return 1;
}
if (gTeam[playerid] != 2)
{
format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
if (gTeam[playerid] != 1)
{
format(string, sizeof(string), "[Paramedic %s:o< %s]", sendername, result);
ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
its somwhere where in there.


Re: 26 errors. - cessil - 30.03.2010

paste the errors too


Re: 26 errors. - Whitetiger - 30.03.2010

change that command to

Код:
public OnPlayerCommandText(playerid, cmdtext) 
{
//...

  if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
  {
    new tmpcar = GetPlayerVehicleID(playerid);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = cmdtext[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
      return 1;
    }
    if (gTeam[playerid] != 2 || 1)
    {
      SendClientMessage(playerid, COLOR_GRAD2, "You are not a police officer or medic!");
      return 1;
    }
    if(!IsACopCar(tmpcar) || !IsAnAmbulance(tmpcar))
    {
      SendClientMessage(playerid, COLOR_GRAD2, " you are not in a service vehicle");
      return 1;
    }
    if (gTeam[playerid] != 2)
    {
      format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
      ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
    }
    if (gTeam[playerid] != 1)
    {
      format(string, sizeof(string), "[Paramedic %s:o< %s]", sendername, result);
      ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
    }
    return 1;
  }//close the command
  //...
  return 0;
} //close OnPlayerCommandText Later
that should fix it, you where missing a bracket at the end


Re: 26 errors. - iLcke - 30.03.2010

Quote:
Originally Posted by cessil
paste the errors too
Most of the time, 26 errors = missing bracket.
Quote:
Originally Posted by [___
Whitetiger [www.sampcommunity.com] ]
change that command to

Код:
public OnPlayerCommandText(playerid, cmdtext) 
{
//...

  if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
  {
    new tmpcar = GetPlayerVehicleID(playerid);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = cmdtext[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
      return 1;
    }
    if (gTeam[playerid] != 2 || 1)
    {
      SendClientMessage(playerid, COLOR_GRAD2, "You are not a police officer or medic!");
      return 1;
    }
    if(!IsACopCar(tmpcar) || !IsAnAmbulance(tmpcar))
    {
      SendClientMessage(playerid, COLOR_GRAD2, " you are not in a service vehicle");
      return 1;
    }
    if (gTeam[playerid] != 2)
    {
      format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
      ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
      }
      if (gTeam[playerid] != 1)
      {
        format(string, sizeof(string), "[Paramedic %s:o< %s]", sendername, result);
        ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
    }
    return 1;
  }//close the command
  //...
  return 0;
} //close OnPlayerCommandText Later
that should fix it, you where missing a bracket at the end
you didnt have to do all the indents


Re: 26 errors. - Whitetiger - 30.03.2010

its easier to read with indentions :P


Re: 26 errors. - iLcke - 30.03.2010

and it don't work for medics:/ ideas?


Re: 26 errors. - CuervO - 30.03.2010

pawn Код:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
    new tmpcar = GetPlayerVehicleID(playerid);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = cmdtext[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
      return 1;
    }
    if (gTeam[playerid] != 1 || gTeam[playerid] != 2) return SendClientMessage(playerid, COLOR_GRAD2, "You are not a police officer or medic!");
    if(!IsACopCar(tmpcar) || !IsAnAmbulance(tmpcar)) return SendClientMessage(playerid, COLOR_GRAD2, " you are not in a service vehicle");
    if (gTeam[playerid] == 2)
    {
        format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
        ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
    }
        else if (gTeam[playerid] == 1)
    {
        format(string, sizeof(string), "[Paramedic %s:o< %s]", sendername, result);
        ProxDetector(60.0,playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
        }
        return 1;
    }



Re: 26 errors. - iLcke - 31.03.2010

still dont work.


Re: 26 errors. - iLcke - 05.04.2010

lets just do a bump here.


Re: 26 errors. - scott1 - 05.04.2010

Usually 26 errors means

Код:
}
Missing somewhere