SA-MP Forums Archive
warning 219: - 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: warning 219: (/showthread.php?tid=566756)



warning 219: - s3ek - 08.03.2015

how to fix this ?

Код:
warning 219: local variable "Distance" shadows a variable at a preceding level
PHP код:
IsPlayerAiming(playeridaimid){
    new 
Float:X1Float:Y1Float:Z1Float:X2Float:Y2Float:Z2;
    
GetPlayerPos(playeridX1Y1Z1);
    
GetPlayerPos(aimidX2Y2Z2);
//    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(playeridA);
        
X1 += (Distance floatsin(-Adegrees));
        
Y1 += (Distance floatcos(-Adegrees));
        
Distance floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
        if(
Distance 1.0){
            return 
true;
        }
    }
    return 
false;




Re: warning 219: - Finnick - 08.03.2015

Where's Warning Line?


Re: warning 219: - s3ek - 08.03.2015

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



Re: warning 219: - Finnick - 08.03.2015

PHP код:
IsPlayerAiming(playeridaimid){ 
       new 
Float:X1Float:Y1Float:Z1Float:X2Float:Y2Float:Z2
       
GetPlayerPos(playeridX1Y1Z1); 
       
GetPlayerPos(aimidX2Y2Z2); 
//     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(playeridA); 
        
X1 += (fDistance floatsin(-Adegrees)); 
        
Y1 += (fDistance floatcos(-Adegrees)); 
        
fDistance floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2)); 
        if(
fDistance 1.0){ 
            return 
true
        } 
    } 
    return 
false

Try This


Re: warning 219: - s3ek - 08.03.2015

it work bro +Rep


Re: warning 219: - Finnick - 08.03.2015

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


Re: warning 219: - X337 - 08.03.2015

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