Small Problem
#1

does anyone know how to fix this warning?

C:\Users\Austin\Desktop\GTA San Andreas\pawno\1.7.pwn(17093) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.



new name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME+3];
Reply
#2

What are you doing?

pawn Код:
new name[MAX_PLAYER_NAME], string[128];
Reply
#3

Use only this:

PHP код:
new name[MAX_PLAYER_NAME]; 
Reply
#4

It can cause if you are using a public with (const string[]), also, try and delete as Sadoww5 just mentiond.
Only the string and tell us what happens.
Reply
#5

It looks like he's using about 17+k lines, so he's downloaded a Gamemode. I've only placed the string because it seems he's doing something with it. The only thing he needed to do was remove the [MAX_PLAYER_NAME+3] and replace it with a value, [128].
Reply
#6

You maybe right, but this error causes not just because of this, there are planty of reasons why it happens. It could be yours or mine or anyone else his. We need to wait for his feedback, whenever he comes.
Reply
#7

Yes ive downloaded a version of bmuks script i have added many things 2 army guys with diffirent spawns, admin system with 5 levels, admins cars, fixed map icons,

what im working on right now is an /admins command it lists all the admins and there levels

if (strcmp("/admins", cmdtext, true) == 0)
{
SendClientMessage(playerid, COLOR_LIME,"|_Current Online ION Administrators_|");
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerAdminLevel[playerid] >= 1)
{
new name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME+3];
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%s(%d)Level is %d",name,i,PlayerAdminLevel[playerid]);
SendClientMessage(playerid, COLOR_PURPLE, string);
}
}
return 1;
}

the command works but with the warning i will try and fix it with the tips you guys provided. thanks!

edit---
renaming to new name[MAX_PLAYER_NAME];
Seems to have fixed my warning Thanks All
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)