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



Shout error - FrostDoggy - 09.08.2011

The command here.

Код:
 if(strcmp(cmd, "/shout", true) == 0 || strcmp(cmd, "/s", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
           if(gPlayerLogged[playerid] == 0)
           {
               SendClientMessage(playerid, COLOR_GREY, "   Nu esti logat pe server !");
               return 1;
           }
         GetPlayerName(playerid, sendername, sizeof(sendername));
         new length = strlen(cmdtext);
         while ((idx < length) && (cmdtext[idx] <= ' '))
         {
            idx++;
         }
         new offset = idx;
         new result[64];
         while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
         {
            result[idx - offset] = cmdtext[idx];
            idx++;
         }
         result[idx - offset] = EOS;
         result[0] = toupper(result[0]);
         if(!strlen(result))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/s)hout [local chat]");
            return 1;
         }
         format(string, sizeof(string), "%s striga: %s!!", GetNameEx(playerid), result);
         ProxDetector(30.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
         printf("%s", string);
      }
      return 1;
   }
And the error lines

Код:
C:\Users\Administrator\Desktop\shout.pwn(99) : error 017: undefined symbol "COLOR_GREY"
C:\Users\Administrator\Desktop\shout.pwn(102) : warning 217: loose indentation
C:\Users\Administrator\Desktop\shout.pwn(102) : error 017: undefined symbol "sendername"
C:\Users\Administrator\Desktop\shout.pwn(102) : error 017: undefined symbol "sendername"
C:\Users\Administrator\Desktop\shout.pwn(102) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\shout.pwn(102) : fatal error 107: too many error messages on one line

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


5 Errors.
Without the COLOR_GREY one I know how to fix it.

Thanks in advance.


Re: Shout error - Grim_ - 09.08.2011

Loose indention is when your indention is not correct. Your problem relies like so:
pawn Код:
if( ... )
{
   if( ... )
   {
      // code
   }
  Function( );
  Function( );
As you can see, the code after this piece
pawn Код:
if(gPlayerLogged[playerid] == 0)
{
   SendClientMessage(playerid, COLOR_GREY, "   Nu esti logat pe server !");
   return 1;
}
is not indented correctly. The beginning of the functions should be aligned right below the following bracket.

As for the undefined symbol, you never created the variable, sendername, to store the player's name you retrieve to. This can be simply fixed by creating the variable.
pawn Код:
new sendername[ MAX_PLAYER_NAME ];



Re: Shout error - FrostDoggy - 09.08.2011

New errors

Код:
C:\Users\Administrator\Desktop\shout.pwn(100) : error 017: undefined symbol "COLOR_GREY"
C:\Users\Administrator\Desktop\shout.pwn(105) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(107) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(107) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\shout.pwn(109) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(111) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(113) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(114) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(114) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\shout.pwn(116) : warning 217: loose indentation
C:\Users\Administrator\Desktop\shout.pwn(116) : error 017: undefined symbol "idx"
C:\Users\Administrator\Desktop\shout.pwn(120) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Administrator\Desktop\shout.pwn(123) : error 017: undefined symbol "string"
C:\Users\Administrator\Desktop\shout.pwn(123) : error 017: undefined symbol "string"
C:\Users\Administrator\Desktop\shout.pwn(123) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\shout.pwn(123) : fatal error 107: too many error messages on one line

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


13 Errors.



Re: Shout error - Grim_ - 09.08.2011

This is exactly why you shouldn't blatantly copy others code and put it directly into your source.

Anyway, you're missing two variables (idx and string) and two color definitions.


Re: Shout error - FrostDoggy - 09.08.2011

Can't you help me..?
Altough a friend made the command for me.


Re: Shout error - emokidx - 09.08.2011

i think you know the colors?

the string will be

pawn Код:
new string[128];
and the idx.. (have a doubt )
pawn Код:
new idx;



Re: Shout error - FrostDoggy - 09.08.2011

I am getting mad

Код:
C:\Users\Administrator\Desktop\shout.pwn(125) : error 017: undefined symbol "GetNameEx"
C:\Users\Administrator\Desktop\shout.pwn(126) : error 017: undefined symbol "ProxDetector"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
New ones


Re: Shout error - JackT - 09.08.2011

instead of using GetNameEx use GetPlayerName

as for proxdetector u shud find out from the script u got it from