Shout error
#1

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.
Reply
#2

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 ];
Reply
#3

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.
Reply
#4

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.
Reply
#5

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

i think you know the colors?

the string will be

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

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
Reply
#8

instead of using GetNameEx use GetPlayerName

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


Forum Jump:


Users browsing this thread: 1 Guest(s)