[HELP] Warnings
#1

How to fix that?

Код:
forward BallDown(playerid, Float:oldz);
public BallDown(playerid, Float:oldz)
{
    new Float:x, Float:y, Float:z;
	GetObjectPos(Ball, x, y, z);
	new Float:a;
	new Float:x2, Float:y2;
	GetPlayerPos(playerid, x2, y2, a);
	GetPlayerFacingAngle(playerid, a);
	x2 += (16 * floatsin(-a, degrees));
	y2 += (16 * floatcos(-a, degrees));
	MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
	Baller = 999;
	ShootingBall = 0;
	BallBounce = 1;
	return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	if (GetPlayerVehicleID(playerid))
	{
	    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}
Код:
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13350) : warning 219: local variable "a" shadows a variable at a preceding level
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13436) : warning 219: local variable "a" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#2

you used triple variable "a" you should make others, look you used it when get player pos for x,y,z but z you gave name a and after you get player facing angle and again used variable "a"
try this ( not tested )

pawn Код:
forward BallDown(playerid, Float:oldz);
public BallDown(playerid, Float:oldz)
{
    new Float:x, Float:y, Float:z;
    GetObjectPos(Ball, x, y, z);
    new Float:a;
    new Float:x2, Float:y2, Float:z2;
    GetPlayerPos(playerid, x2, y2, z2);
    GetPlayerFacingAngle(playerid, a);
    x2 += (16 * floatsin(-a, degrees));
    y2 += (16 * floatcos(-a, degrees));
    MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
    Baller = 999;
    ShootingBall = 0;
    BallBounce = 1;
    return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a,Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply
#3

Код:
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13350) : warning 219: local variable "a" shadows a variable at a preceding level
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13436) : warning 219: local variable "a" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
The appearance of the same..
Reply
#4

maybe you declareted before, check if it's declareted before
public OnGameModInt
Reply
#5

Clean script(shouldn't give you any error/warning,i hope):
pawn Код:
forward BallDown(playerid, Float:oldz);
public BallDown(playerid, Float:oldz)
{
    new Float:x, Float:y, Float:z;
    GetObjectPos(Ball, x, y, z);
    new Float:a;
    new Float:x2, Float:y2;
    GetPlayerPos(playerid, x2, y2, z2); // its a hieght,not a facing angle :|
    GetPlayerFacingAngle(playerid, a);
    x2 += (16 * floatsin(-a, degrees));
    y2 += (16 * floatcos(-a, degrees));
    MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
    Baller = 999;
    ShootingBall = 0;
    BallBounce = 1;
    return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
//    new Float:a;  you already used 1 like this,idk if it can couse in warnings but would be better if it will be changed
        new Float:FA,Float:pz,Float:vz;
    GetPlayerPos(playerid, x, y, pz); // its x,y,z not x,y,a
    GetPlayerFacingAngle(playerid, FA);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), vz); //vehicle hieght not Facing Angle
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
try it,maybe it will work
Reply
#6

Oh no!

Код:
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13350) : warning 219: local variable "a" shadows a variable at a preceding level
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13352) : error 017: undefined symbol "z2"
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13444) : warning 213: tag mismatch
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13445) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

Quote:
Originally Posted by xkirill
Посмотреть сообщение
Clean script(shouldn't give you any error/warning,i hope):
pawn Код:
forward BallDown(playerid, Float:oldz);
public BallDown(playerid, Float:oldz)
{
    new Float:x, Float:y, Float:z;
    GetObjectPos(Ball, x, y, z);
    new Float:a;
    new Float:x2, Float:y2;
    GetPlayerPos(playerid, x2, y2, z2); // its a hieght,not a facing angle :|
    GetPlayerFacingAngle(playerid, a);
    x2 += (16 * floatsin(-a, degrees));
    y2 += (16 * floatcos(-a, degrees));
    MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
    Baller = 999;
    ShootingBall = 0;
    BallBounce = 1;
    return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
//    new Float:a;  you already used 1 like this,idk if it can couse in warnings but would be better if it will be changed
        new Float:FA,Float:pz,Float:vz;
    GetPlayerPos(playerid, x, y, pz); // its x,y,z not x,y,a
    GetPlayerFacingAngle(playerid, FA);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), vz); //vehicle hieght not Facing Angle
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
try it,maybe it will work
Quote:
Originally Posted by V4at
Посмотреть сообщение
Oh no!

Код:
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13350) : warning 219: local variable "a" shadows a variable at a preceding level
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13352) : error 017: undefined symbol "z2"
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13444) : warning 213: tag mismatch
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13445) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
try to resolve the errors/warnings by yourself sometimes,we can't resolve your problems all the time.
btw:
pawn Код:
forward BallDown(playerid, Float:oldz);
public BallDown(playerid, Float:oldz)
{
    new Float:x, Float:y, Float:z;
    GetObjectPos(Ball, x, y, z); // y are you using it ?
    new Float:a;
    new Float:x2, Float:y2,Float:z2;
    GetPlayerPos(playerid, x2, y2, z2); // its a hieght,not a facing angle :|
    GetPlayerFacingAngle(playerid, a);
    x2 += (16 * floatsin(-a, degrees));
    y2 += (16 * floatcos(-a, degrees));
    MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
    Baller = 999;
    ShootingBall = 0;
    BallBounce = 1;
    return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
//    new Float:a;  you already used 1 like this,idk if it can couse in warnings but would be better if it will be changed
        new Float:FA,Float:pz,Float:vz;
    GetPlayerPos(playerid, x, y, pz); // its x,y,z not x,y,a
    GetPlayerFacingAngle(playerid, FA);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), vz); //vehicle hieght not Facing Angle
    }
    x += (distance * floatsin(-FA, degrees));
    y += (distance * floatcos(-FA, degrees));
}
forgot some things,sorry.
Reply
#8

Код:
C:\Documents and Settings\Admin\Desktop\FunZoneLT\gamemodes\FreeRoamLT.pwn(13350) : warning 219: local variable "a" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Strange :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)