SA-MP Forums Archive
[Help] How can i fix this warning - 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] How can i fix this warning (/showthread.php?tid=285485)



[Help] How can i fix this warning - Jimbo01 - 24.09.2011

Код:
C:\Dokumente und Einstellungen\Ab\Desktop\Ver3\gamemodes\Gamemode.pwn(6089) : warning 219: local variable "x" shadows a variable at a preceding level



Re: [Help] How can i fix this warning - aRoach - 24.09.2011

Delete new Float: x; or what is it at Line 6089 and use another Variable


Re: [Help] How can i fix this warning - CyNiC - 24.09.2011

Delete the declaration of 'x' in the function.
Something like this:
pawn Код:
new Float:x



Re: [Help] How can i fix this warning - Jimbo01 - 24.09.2011

Код:
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	switch(IsPlayerInAnyVehicle(playerid))
	{
	    case 0: GetPlayerFacingAngle(playerid, a);
	    case 1: GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
	return a;
}
so i change x to F and y to G example ? and then i must change all lines wich using the function ( GetPosInFrontOfPlayer )


Re: [Help] How can i fix this warning - [MWR]Blood - 24.09.2011

Quote:
Originally Posted by Jimbo01
Посмотреть сообщение
so i change x to F and y to G example ? and then i must change all lines wich using the function ( GetPosInFrontOfPlayer )
No.
Just delete the
pawn Код:
new Float:x;
because it has been already defined somewhere in your script.


Re: [Help] How can i fix this warning - Jimbo01 - 24.09.2011

thanks but i dont have new float: x;

the error line is this

stock Float:GetPosInFrontOfPlayer(playerid, &Float, &Float:y, Float:distance)

what should i remove ?


Re: [Help] How can i fix this warning - CmZxC - 24.09.2011

Remove the Float: infront of getposinfrontofplayer.

rename the &Float: x to something like Float:gX , Float:gY and on and on.

And yes, you must replace others too, not just on the stock().
It wont take long, just do it. Better than waiting for a response for 15 minutes.