SA-MP Forums Archive
Warning 217: Loose indentation :S - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Warning 217: Loose indentation :S (/showthread.php?tid=225408)



Warning 217: Loose indentation :S - xemper - 13.02.2011

C:\Users\Frede\Desktop\Server\Raven's Roleplay 0.3c\gamemodes\larp.pwn(53594) : warning 217: loose indentation
C:\Users\Frede\Desktop\Server\Raven's Roleplay 0.3c\gamemodes\larp.pwn(53601) : warning 217: loose indentation
C:\Users\Frede\Desktop\Server\Raven's Roleplay 0.3c\gamemodes\larp.pwn(53605) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Warnings.


Here's the pastebin http://bb3dev.pastebin.com/ZiYNTKKB


Re: Warning 217: Loose indentation :S - xRyder - 13.02.2011

pawn Код:
if(strcmp(cmd, "/flip", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new Float:PX, Float:PY, Float:PZ, Float:PA;
            GetPlayerPos(playerid, PX, PY, PZ); // Im getting warning on THIS line
            GetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
            SetVehiclePos(GetPlayerVehicleID(playerid), PX, PY, PZ+1);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
            SendClientMessage(playerid, COLOR_GREEN," Vehicle Succesfully Flipped!");
        }
    }
    else return SendClientMessage(playerid, COLOR_GRAD1, " You Are Not An Admin Level 3!");
    return 1; // And this..
}



Re: Warning 217: Loose indentation :S - Ash. - 13.02.2011

Simple, just check the indentation of your code.


Re: Warning 217: Loose indentation :S - HyperZ - 13.02.2011

Put this under inc's:
pawn Код:
#pragma tabsize 0



Re: Warning 217: Loose indentation :S - xemper - 13.02.2011

@xRyder thanks it worked.

@Clive I do that now.


Re: Warning 217: Loose indentation :S - JaTochNietDan - 13.02.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
Put this under inc's:
pawn Код:
#pragma tabsize 0
That's not fixing the problem, it's merely hiding it. Although if you don't want to indent code that's fine, but it only makes it harder for you to read the code and a lot harder to find problems with your code.

xRyder's code is how the code should be indented, it makes it a lot easier to read and understand.


Re: Warning 217: Loose indentation :S - HyperZ - 13.02.2011

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
That's not fixing the problem, it's merely hiding it. Although if you don't want to indent code that's fine, but it only makes it harder for you to read the code and a lot harder to find problems with your code.

xRyder's code is how the code should be indented, it makes it a lot easier to read and understand.
Okay sir


Re: Warning 217: Loose indentation :S - Mean - 13.02.2011

Yes, this is what indentation is:


BAD indentation
pawn Код:
CMD:random( playerid, params[ ] )
{
 SendClientMessage( playerid, 0xAAAAA, "Abcd" );
    SendClientMessage(playerid, 0xAAAAAA, "Very bad indentation" );
return 1;
}
GOOD indentation:
pawn Код:
CMD:random( playerid, params[ ] )
{
    SendClientMessage( playerid, 0xAAAAA, "Abcd" );
    SendClientMessage( playerid, 0xAAAAAA, "Very good indentation" );
    return 1;
}
You should now understand why you get that warning.
Since no one explained why this warning is appearing. If your code is not in the right order (not placed rightly) it will give you warnings.
#pragma tabsize 0 can fak the script, I recommend not using it.
Deufault tabsize of SA-MP is 4, and you should respect it!
It's always best to show it with examples, then people understand it .