SA-MP Forums Archive
Does this Matter (indentation issue) - 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: Does this Matter (indentation issue) (/showthread.php?tid=263820)



Does this Matter (indentation issue) - euRo - 23.06.2011

As you can see case DIALOG_HELP is set slightly to the right but all other indentations are lined up there on out
Reason being if i had to aline it i'd have to go through hundreds of lines





Re: Does this Matter (indentation issue) - gimini - 23.06.2011

Just select all these lines and press SHIFT+TAB, it will remove the indentation


Re: Does this Matter (indentation issue) - Wesley221 - 23.06.2011

Quote:
Originally Posted by gimini
Посмотреть сообщение
Just select all these lines and press SHIFT+TAB, it will remove the indentation
But this will also make your script un-organized

If you're to lazy to do it yourself, use this http://dracoblue.net/tidy/pawn/


Re: Does this Matter (indentation issue) - gimini - 23.06.2011

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
But this will also make your script un-organized
No, just try it and you will see how it works..


Re: Does this Matter (indentation issue) - Wesley221 - 23.06.2011

Example of your "solution":
pawn Код:
if(dialogid == TRANSFERBB)
{
if(response)
{
new target[MAX_PLAYER_NAME], cast[MAX_PLAYER_NAME], mystring[128], targetstring[128], targetfile[128], myfile[128];
if(!strlen(inputtext)) return SendClientMessage(playerid, SKY_BLUE, " ** playerid amount") && TransferBB
if(strlen(inputtext))
{
new TargetID, Amount;
if(!sscanf(inputtext, "ui", TargetID, Amount))
{
GetPlayerName(playerid, cast, sizeof cast); GetPlayerName(TargetID, target, sizeof target);
format(targetfile, sizeof targetfile, Bankfile, target); format(myfile, sizeof myfile, Bankfile, cast);
if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, SKY_BLUE, " ** Invalid playerid! ") && TransferBB
if(TargetID == playerid) return SendClientMessage(playerid, SKY_BLUE, " ** You can't send money to your own bank account! ") && TransferBB
if(Amount > dini_Int(myfile, "Cash amount")) return SendClientMessage(playerid, SKY_BLUE, " ** You do not have that amount of money on your bank account! ") && TransferBB
if(Amount < dini_Int(myfile, "Cash amount"))
{
dini_IntSet(myfile, "Cash amount", dini_Int(myfile, "Cash amount") - Amount); dini_IntSet(targetfile, "Cash amount", dini_Int(targetfile, "Cash amount") + Amount);
format(mystring, sizeof mystring, " ** You transfered $%i to %s his bank account ", Amount, TargetID);
format(targetstring, sizeof targetstring, " ** %s transfered $%i to your bank account ", cast, Amount);
SendClientMessage(playerid, SKY_BLUE, mystring); SendClientMessage(TargetID, SKY_BLUE, targetstring);
}
} else {
return SendClientMessage(playerid, SKY_BLUE, " ** playerid amount") && TransferBB
}
} else {
return SendClientMessage(playerid, SKY_BLUE, " ** Please fill in something ")&& TransferBB
}
}
else if(!response)
{
Bankhome
}
}
Example of the same code, but then with tabs:
pawn Код:
if(dialogid == TRANSFERBB)
    {
        if(response)
        {
            new target[MAX_PLAYER_NAME], cast[MAX_PLAYER_NAME], mystring[128], targetstring[128], targetfile[128], myfile[128];
            if(!strlen(inputtext)) return SendClientMessage(playerid, SKY_BLUE, " ** playerid amount") && TransferBB
            if(strlen(inputtext))
            {
                new TargetID, Amount;
                if(!sscanf(inputtext, "ui", TargetID, Amount))
                {
                    GetPlayerName(playerid, cast, sizeof cast); GetPlayerName(TargetID, target, sizeof target);
                    format(targetfile, sizeof targetfile, Bankfile, target); format(myfile, sizeof myfile, Bankfile, cast);
                    if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, SKY_BLUE, " ** Invalid playerid! ") && TransferBB
                    if(TargetID == playerid) return SendClientMessage(playerid, SKY_BLUE, " ** You can't send money to your own bank account! ") && TransferBB
                    if(Amount > dini_Int(myfile, "Cash amount")) return SendClientMessage(playerid, SKY_BLUE, " ** You do not have that amount of money on your bank account! ") && TransferBB
                    if(Amount < dini_Int(myfile, "Cash amount"))
                    {
                        dini_IntSet(myfile, "Cash amount", dini_Int(myfile, "Cash amount") - Amount); dini_IntSet(targetfile, "Cash amount", dini_Int(targetfile, "Cash amount") + Amount);
                        format(mystring, sizeof mystring, " ** You transfered $%i to %s his bank account ", Amount, TargetID);
                        format(targetstring, sizeof targetstring, " ** %s transfered $%i to your bank account ", cast, Amount);
                        SendClientMessage(playerid, SKY_BLUE, mystring); SendClientMessage(TargetID, SKY_BLUE, targetstring);
                    }
                } else {
                    return SendClientMessage(playerid, SKY_BLUE, " ** playerid amount") && TransferBB
                }
            } else {
                return SendClientMessage(playerid, SKY_BLUE, " ** Please fill in something ")&& TransferBB
            }
        }
        else if(!response)
        {
            Bankhome
        }
    }
Last piece is way more organized


Re: Does this Matter (indentation issue) - gimini - 23.06.2011

Wesley221, don't be a noob, press SHIFT+TAB once - it will delete indentation by one tab


Re: Does this Matter (indentation issue) - Wesley221 - 23.06.2011

I know if you press shift+tab once it goes back one tab. I just missunderstood you, no need to call me a noob immediately.