some warnings
#1

I got some warnings on this that i donґt know how to fix.
The first two is in my /Pme CMD

the warning is on
Код:
new giveplayerid = ReturnUser(tmp);
warning 219: local variable "giveplayerid" shadows a variable at a preceding level
Код:
	if(strcmp(cmd, "/pme", true) == 0)
	{
     if(Loggad[playerid] == 1)
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
	        {
	            SCM(playerid, COLOR_WHITE, "USAGE: /Pme <Player ID> <Message>");
	            return 1;
			}
   			new giveplayerid = ReturnUser(tmp);
   			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;
			if(!strlen(result))
	        {
	            SCM(playerid, COLOR_WHITE, "USAGE: /Pme <Player ID> <Message>");
	            return 1;
			}
			if(IsPlayerConnected(giveplayerid))
			{
			    new Text2[355];
			    GetPlayerName(playerid, Spelare, sizeof(Spelare));
			    GetPlayerName(giveplayerid, Spelare2, sizeof(Spelare2));
			    format(Text2, sizeof(Text2), "** Private Message From %s: %s **", Spelare, result);
			    SCM(giveplayerid, COLOR_YELLOW, Text2);
			    format(Text2, sizeof(Text2), "** Private Message Sent to %s: %s **", Spelare2, result);
			    SCM(playerid, COLOR_YELLOW, Text2);
			}
			else{SCM(playerid, COLOR_RED, "MAIN ERROR(That player isn't online!)");}
		}
		return 1;
	}
the next two is wierd. Its my defines. if i remove the two warning lines (43-44)
Код:
#define TEAM_ORANGE_COLOR 0xFF830000
#define TEAM_COR_COLOR 0x39393900
i will still get warnings on 43-44 even if the two lines are replaced with some other defines. why?
Код:
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BLUE 0x33CCFFAA
#define c_y 0xFFFF00AA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_GREY 0xBEBEBEAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED 0xAA3333AA
#define SCM SendClientMessage
#define GameLanguageText
#define GGameTextForAll
#define TEAM_CYAN 1
#define TEAM_BLUE 2
#define TEAM_GREEN 3
#define TEAM_ORANGE 4
#define TEAM_COR 5
#define TEAM_BAR 6
#define TEAM_TAT 7
#define TEAM_CUN 8
#define TEAM_STR 9
#define TEAM_HIT 10
#define TEAM_ADMIN 11
#define TEAM_GREEN_COLOR 0xFFFFFFAA
#define TEAM_JOB_COLOR 0xFFB6C1AA
#define TEAM_HIT_COLOR 0xFFFFFF00
#define TEAM_BLUE_COLOR 0x8D8DFF00
#define TEAM_GROVE_COLOR 0x00D900C8
#define TEAM_VAGOS_COLOR 0xFFC801C8
#define TEAM_BALLAS_COLOR 0xD900D3C8
#define TEAM_AZTECAS_COLOR 0x01FCFFC8
#define TEAM_CYAN_COLOR 0xFF8282AA
#define TEAM_ORANGE_COLOR 0xFF830000
#define TEAM_COR_COLOR 0x39393900
#define TEAM_BAR_COLOR 0x00D90000
#define TEAM_TAT_COLOR 0xBDCB9200
#define TEAM_CUN_COLOR 0xD900D300
#define TEAM_STR_COLOR 0x01FCFF00
#define TEAM_ADMIN_COLOR 0x00808000
Reply
#2

new giveplayerid = ReturnUser(tmp);
to
giveplayerid = ReturnUser(tmp);
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
new giveplayerid = ReturnUser(tmp);
to
giveplayerid = ReturnUser(tmp);
Thanks!
o also forgot to say that the "return" gets the warning
Код:
pwn(811) : warning 217: loose indentation
Reply
#4

Quote:
Originally Posted by cruising
Посмотреть сообщение
Thanks!
o also forgot to say that the "return" gets the warning
Код:
pwn(811) : warning 217: loose indentation
just tab the return to the right a bit and that will fix it...
Reply
#5

Quote:
Originally Posted by marharth
Посмотреть сообщение
just tab the return to the right a bit and that will fix it...
hmm.. it doesn't matter if i tab it 1 or 5 times. its still the same
Reply
#6

Quote:
Originally Posted by cruising
Посмотреть сообщение
hmm.. it doesn't matter if i tab it 1 or 5 times. its still the same
Try backspacing..If this doesn't work you can always use

pawn Код:
#pragma tabsize 0
At the top of your script.

Quote:
Originally Posted by wiki.sa-mp.com
Indentation means to push text along from the left of the page. This is used in pawn to make code easier to read.
Reply
#7

Loose indentation means you have missed some spaces or added more spaces. Just use backspace until the compiler compiles it successfully, or use spaces. Also, you don't need to use #pragma tabsize 0
Reply
#8

Quote:
Originally Posted by Adil
Посмотреть сообщение
Loose indentation means you have missed some spaces or added more spaces. Just use backspace until the compiler compiles it successfully, or use spaces. Also, you don't need to use #pragma tabsize 0
thanks!
I tried again and now i fixed it without the #pragma tabsize

but the defines are still warned and dont know whats cause the warnings
Reply
#9

Quote:
Originally Posted by cruising
Посмотреть сообщение
thanks!
I tried again and now i fixed it without the #pragma tabsize

but the defines are still warned and dont know whats cause the warnings
pawn Код:
#define COLOR_WHITE 0xFFFFFFAA
#define TEAM_GREEN_COLOR 0xFFFFFFAA
Are using the same variable
pawn Код:
0xFFFFFFAA
Reply
#10

Quote:
Originally Posted by Souvlaki
Посмотреть сообщение
pawn Код:
#define COLOR_WHITE 0xFFFFFFAA
#define TEAM_GREEN_COLOR 0xFFFFFFAA
Are using the same variable
pawn Код:
0xFFFFFFAA
Yes you are right, but if i remove one of them i still got the same warning on 43-44.
And if i remove line 43-44 so the lines is blank, or replace them with some other define i still get the warning :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)