SA-MP Forums Archive
Help me please, this strings... - 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)
+--- Thread: Help me please, this strings... (/showthread.php?tid=327154)



Help me please, this strings... - DatNewbie - 20.03.2012

Hi, well I'm taking a long time to put these 'warnings' and wanted to know if I can help solve them.

(3312): warning 219: local variable "string" shadows a variable at a preceding level

new string [256];

I checked if there are more strings in the code but no, they are not.
thanks for all.


Re: Help me please, this strings... - new121 - 20.03.2012

Ok, fist off, warnings are not as badd as errors your script may still work while having warnings but it is still good to have a clean complile, what that means is there is another variable with the same name so just delete the line giving you the warning and you should be good.


Re: Help me please, this strings... - Skribblez - 20.03.2012

edit: the post above me is correct.

but it is best to compile your script without having any warnings.


Re: Help me please, this strings... - [ABK]Antonio - 20.03.2012

Quote:
Originally Posted by new121
Посмотреть сообщение
Ok, fist off, warnings are not as badd as errors your script may still work while having warnings but it is still good to have a clean complile, what that means is there is another variable with the same name so just delete the line giving you the warning and you should be good.
Warnings are just as bad as errors and should be noted (depending on the warning)...


Re: Help me please, this strings... - DatNewbie - 20.03.2012

This is the script, did not see anything wrong, help please.


public SearchingHit(playerid)
{
new string[256];
new giveplayer[128];
new searchhit = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(searchhit == 0)
{
if(InfoJugador[i][pHeadValue] > 0 && GotHit[i] == 0 && InfoJugador[i][pMember] !=
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
Replace(giveplayer, "_", "*");
searchhit = 1;
//hitfound = 1;
//hitid = i;
for(new k=0; k<MAX_PLAYERS; k++)
{
if(IsPlayerConnected(k))
{
if(InfoJugador[k][pMember] == 8 || InfoJugador[k][pLeader] ==
{
SendClientMessage(k, COLOR_WHITE, "|__________________ Agencia de Sicarios __________________|");
SendClientMessage(k, COLOR_DBLUE, "*** Mensaje entrante: Nuevo trabajo disponible. ***");
format(string, sizeof(string), "Persona: %s ID: %d Valor: %d$", giveplayer, i, InfoJugador[i][pHeadValue]);
SendClientMessage(k, COLOR_DBLUE, string);
SendClientMessage(k, COLOR_YELLOW, "Usa Golpe ID, para asignar un contrato a un Sicario.");
SendClientMessage(k, COLOR_WHITE, "|________________________________________________ ________|");
}
}
}
return 0;
}
}
}
}
if(searchhit == 0)
{
SendClientMessage(playerid, COLOR_GREY, " No hay contratos disponibles!");
}
return 0;
}


Re: Help me please, this strings... - new121 - 20.03.2012

pawn Код:
public SearchingHit(playerid)
{
new str[256];
new giveplayer[MAX_PLAYER_NAME];
new searchhit = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(searchhit == 0)
{
if(InfoJugador[i][pHeadValue] > 0 && GotHit[i] == 0 && InfoJugador[i][pMember] != 8)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
Replace(giveplayer, "_", "*");
searchhit = 1;
//hitfound = 1;
//hitid = i;
for(new k=0; k<MAX_PLAYERS; k++)
{
if(IsPlayerConnected(k))
{
if(InfoJugador[k][pMember] == 8 || InfoJugador[k][pLeader] == 8)
{
SendClientMessage(k, COLOR_WHITE, "|__________________ Agencia de Sicarios __________________|");
SendClientMessage(k, COLOR_DBLUE, "*** Mensaje entrante: Nuevo trabajo disponible. ***");
format(str,sizeof(str), "Persona: %s   ID: %d   Valor: %d$", giveplayer, i, InfoJugador[i][pHeadValue]);
SendClientMessage(k, COLOR_DBLUE, str);
SendClientMessage(k, COLOR_YELLOW, "Usa Golpe ID, para asignar un contrato a un Sicario.");
SendClientMessage(k, COLOR_WHITE, "|________________________________________________________|");
}
}
}
return 0;
}
}
}
}
if(searchhit == 0)
{
SendClientMessage(playerid, COLOR_GREY, "   No hay contratos disponibles!");
}
return 0;
}



Re: Help me please, this strings... - DatNewbie - 20.03.2012

Quote:
Originally Posted by new121
Посмотреть сообщение
pawn Код:
public SearchingHit(playerid)
{
new str[256];
new giveplayer[MAX_PLAYER_NAME];
new searchhit = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(searchhit == 0)
{
if(InfoJugador[i][pHeadValue] > 0 && GotHit[i] == 0 && InfoJugador[i][pMember] != 8)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
Replace(giveplayer, "_", "*");
searchhit = 1;
//hitfound = 1;
//hitid = i;
for(new k=0; k<MAX_PLAYERS; k++)
{
if(IsPlayerConnected(k))
{
if(InfoJugador[k][pMember] == 8 || InfoJugador[k][pLeader] == 8)
{
SendClientMessage(k, COLOR_WHITE, "|__________________ Agencia de Sicarios __________________|");
SendClientMessage(k, COLOR_DBLUE, "*** Mensaje entrante: Nuevo trabajo disponible. ***");
format(str,sizeof(str), "Persona: %s   ID: %d   Valor: %d$", giveplayer, i, InfoJugador[i][pHeadValue]);
SendClientMessage(k, COLOR_DBLUE, str);
SendClientMessage(k, COLOR_YELLOW, "Usa Golpe ID, para asignar un contrato a un Sicario.");
SendClientMessage(k, COLOR_WHITE, "|________________________________________________________|");
}
}
}
return 0;
}
}
}
}
if(searchhit == 0)
{
SendClientMessage(playerid, COLOR_GREY, "   No hay contratos disponibles!");
}
return 0;
}

TY!, thanks for the help guys, solved


Re: Help me please, this strings... - new121 - 20.03.2012

Quote:
Originally Posted by DatNewbie
Посмотреть сообщение
TY!, thanks for the help guys, solved
The reason that was not working for you is becasue string was already defined, when you get those errors just rename your variable.