SA-MP Forums Archive
error D: - 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 D: (/showthread.php?tid=65513)



error D: - My_Waffles_Bitch_L0L - 13.02.2009

i got this:

Код:
public OnPlayerText(playerid, text[])
{
  if(PlayerData[playerid][Muted] == 1) {
    return 0;

  }
  else
	{
  if(PlayerData[playerid][AdminLevel] >= 1) && text[0]=='#') {
    new tmp[256], string[256], idx, pname2[MAX_PLAYERS];
    tmp = strtok(params, idx);

    GetPlayerName(playerid,pname2,sizeof(pname2));
    format(string, sizeof(string), "[ADMIN] %s: %s", pname2, params);
    AdminMessage(COLOR_PINK, string);
  return true;
}
and got these errors:

Код:
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(45) : error 079: inconsistent return types (array & non-array)
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(50) : warning 215: expression has no effect
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(50) : error 001: expected token: ";", but found ")"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\WafflesAdmin.pwn(50) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
help :P


Re: error D: - Daren_Jacobson - 13.02.2009

what is line 45?


Re: error D: - Ycto - 13.02.2009

Oh come on, I guess you see an erroring line without even knowing the line..

Код:
if(PlayerData[playerid][AdminLevel] >= 1) && text[0]=='#') {
Take a good look at it, you'll see it should be:

Код:
if(PlayerData[playerid][AdminLevel] >= 1 && text[0]=='#') {
Also, there has to be one more bracket, here's the correct code:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PlayerData[playerid][Muted] == 1)
    {
        return 0;
    }
    else
    {
        if(PlayerData[playerid][AdminLevel] >= 1 && text[0]=='#')
        {
            new tmp[256], string[256], idx, pname2[MAX_PLAYERS];
            tmp = strtok(params, idx);
            GetPlayerName(playerid,pname2,sizeof(pname2));
            format(string, sizeof(string), "[ADMIN] %s: %s", pname2, params);
            AdminMessage(COLOR_PINK, string);
        }
        return true;
    }
And I guess the rest of the OnPlayerCommandText comes after this. Or it'll still give errors :P