Help With Wierd Warning :S
#1

I get this warning:

Код:
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(721) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
On This Code:

Код:
        if(!strcmp(cmdtext, "/tc", true))//Team Chat
        {
        new string[128], Player[MAX_PLAYER_NAME];//<-------line 721
        GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
        format(string, 128, "[Team Chat]: %s: %s", Player, cmdtext[2]);
        for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, RED, string);
        return 1;
        }
And its really trippn me out :S

Please help..
Reply
#2

This is because string is already defined in that scope, so you don't need to initialize it again.

new string[128]; remove it from that piece of code you posted, or else remove the other string that you've created in the higher level scope. Alternatively you could re-name it to something else.
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
This is because string is already defined in that scope, so you don't need to initialize it again.

new string[128]; remove it from that piece of code you posted, or else remove the other string that you've created in the higher level scope. Alternatively you could re-name it to something else.
Thanks Alot Dude!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)