SA-MP Forums Archive
Preceding level variable - 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: Preceding level variable (/showthread.php?tid=475520)



Preceding level variable - whando - 13.11.2013

warning 219: local variable "giveplayerid" shadows a variable at a preceding level < That x65.

Код:
stock RPN(giveplayerid)
{
 new name[MAX_PLAYER_NAME];
	GetPlayerName(giveplayerid,name,sizeof(name));
	for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
	if(name[i] == '_') name[i] = ' ';
}
	return name;
}

stock RemoveUnderScore(playerid)
{
 new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof(name));
	for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
	if(name[i] == '_') name[i] = ' ';
}
	return name;
}
Happened when I added RPN(giveplayerid) stock, anyway to combine them or to remove the warnings?


Re: Preceding level variable - Konstantinos - 13.11.2013

Change giveplayerid to something else because giveplayerid is used somewhere else (global).

pawn Код:
stock RPN(playerid)
{
    new name[MAX_PLAYER_NAME], lenght;
    GetPlayerName(playerid,name,sizeof(name));
    lenght = strlen(name);
    for(new i = 0; i < lenght; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}