warning 219:
#1

how to fix this ?

Код:
warning 219: local variable "Distance" shadows a variable at a preceding level
PHP код:
IsPlayerAiming(playerid, aimid){
    new 
Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
    
GetPlayerPos(playerid, X1, Y1, Z1);
    
GetPlayerPos(aimid, X2, Y2, Z2);
//    new keys, own, pwn;
//    GetPlayerKeys(playerid, keys, own, pwn);
//    if(!(keys & KEY_SECONDARY_ATTACK))return false;
    
new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
    if(
Distance < 100){
        new 
Float:A;
        
GetPlayerFacingAngle(playerid, A);
        
X1 += (Distance * floatsin(-A, degrees));
        
Y1 += (Distance * floatcos(-A, degrees));
        
Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
        if(
Distance < 1.0){
            return 
true;
        }
    }
    return 
false;
} 
Reply
#2

Where's Warning Line?
Reply
#3

PHP код:
new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2)); 
Reply
#4

PHP код:
IsPlayerAiming(playerid, aimid){ 
       new 
Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2; 
       
GetPlayerPos(playerid, X1, Y1, Z1); 
       
GetPlayerPos(aimid, X2, Y2, Z2); 
//     new keys, own, pwn; 
//     GetPlayerKeys(playerid, keys, own, pwn); 
//     if(!(keys & KEY_SECONDARY_ATTACK))return false; 
        
new Float:fDistance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2)); 
        if(
fDistance < 100){ 
        new 
Float:A; 
        
GetPlayerFacingAngle(playerid, A); 
        
X1 += (fDistance * floatsin(-A, degrees)); 
        
Y1 += (fDistance * floatcos(-A, degrees)); 
        
fDistance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2)); 
        if(
fDistance < 1.0){ 
            return 
true; 
        } 
    } 
    return 
false; 
} 
Try This
Reply
#5

it work bro +Rep
Reply
#6

Quote:
Originally Posted by s3ek
Посмотреть сообщение
it work bro +Rep
My REP Still 12 LoL :v
Reply
#7

You need at least 1 rep and 25 posts to give someone rep lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)