SA-MP Forums Archive
Loose Indentation - 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: Loose Indentation (/showthread.php?tid=158296)



Loose Indentation - Master™ - 09.07.2010

I have a loose indention I need help with

Код:
                                            ApplyAnimation(i,"PED", "WALK_DRUNK",4.0,0,1,0,0,0);
					    SetPlayerDrunkLevel(i, 10000);
					    PlayerDrunkTimeLeft[i] += 1;
					    if(PlayerDrunkTimeLeft[i] == 4)
					    {
					        PlayerDrunkTimeLeft[i] = 0;
					        PlayerDrunk[i] -= 1;
					        if(PlayerDrunk[i] < 5)
					        {
					        	GameTextForPlayer(i, "~w~Drunk Effect Has~n~~p~Wore Off", 3500, 1);
					        	SetPlayerDrunkLevel(i, 0);
					        }
					    }
					}
			         }
                     }
    		     if(PlayerInfo[i][pCarTime] > 0)
    		     {
		 	    if(PlayerInfo[i][pCarTime] <= 0)
			    {
			         PlayerInfo[i][pCarTime] = 0;
			    }
			    else
			    {
			        PlayerInfo[i][pCarTime] -= 1;
			    }
			}
			if(BoxWaitTime[i] > 0)
			{
Yes, i know its not the full script.. My loose indentation is the first [pCarTime]


Re: Loose Indentation - [XST]O_x - 09.07.2010

You can fix it,but there's an easier way for lazy people(like me =D)
Add #pragma tabsize 0 somewhere ^^
Though loose indentations are totally harmless and won't affect on your script at all.


Re: Loose Indentation - Grim_ - 09.07.2010

This is one of the examples:
pawn Код:
if(PlayerInfo[i][pCarTime] > 0)
                 {
                if(PlayerInfo[i][pCarTime] <= 0)
                {
                     PlayerInfo[i][pCarTime] = 0;
                }
                else
                {
                    PlayerInfo[i][pCarTime] -= 1;
                }
            }
The brackets aren't lined up accordingly. Line them up and the warnings will disappear.

AMG, don't encourage lazy coding!


Re: Loose Indentation - Hiddos - 09.07.2010

No idea but I do see some unreachable code:

pawn Код:
if(PlayerInfo[i][pCarTime] > 0) //Is the value more then 0?
                 {
                if(PlayerInfo[i][pCarTime] <= 0) // Is the value lower then or equal to 0?



Re: Loose Indentation - Cameltoe - 09.07.2010

I like using that too, and even lazier theres a script that auto indents your code xD


Re: Loose Indentation - Jeffry - 09.07.2010

Add: #pragma tabsize 0

This will ignore the indention.



To explain it:

pawn Код:
Test
Test
Test
  Test
Test
pawn Код:
Test
Test
Test
Test
Test

1st will give you wanring, 2nd not.


Re: Loose Indentation - Master™ - 09.07.2010

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Add: #pragma tabsize 0

This will ignore the indention.



To explain it:

pawn Код:
Test
Test
Test
  Test
Test
pawn Код:
Test
Test
Test
Test
Test

1st will give you wanring, 2nd not.
I understand, the problem is it just wont go away, no matter how many ways i put it.. I dont wanna be lazy with the tabsize thing


Re: Loose Indentation - Grim_ - 09.07.2010

Quote:
Originally Posted by LucoC
Посмотреть сообщение
I understand, the problem is it just wont go away, no matter how many ways i put it.. I dont wanna be lazy with the tabsize thing
Because of that, you have my upmost respect.

All you need to do is align the brackets Take a good look at the code and line them up!


Re: Loose Indentation - Jeffry - 09.07.2010

If you want you can send me the FULL script via PM. Then i'm gonna check it for you.

PS: I'm not a script stealer, as you can see in my signature, I have my own server. I won't use your script or give it away.


Re: Loose Indentation - Hiddos - 09.07.2010

What Jeffry means is that it's useless to him anyways.

pawn Код:
SetPlayerDrunkLevel(i, 0);
                            }
                        }
                    }
                     }
                     }
                 if(PlayerInfo[i][pCarTime] > 0)//hingy
                 {
                if(PlayerInfo[i][pCarTime] <= 0)
                {
                     PlayerInfo[i][pCarTime] = 0;
                }
                else
                {
                    PlayerInfo[i][pCarTime] -= 1;
                }
            }
            if(BoxWaitTime[i] > 0)// Thingy
            {
There's the mismatch

Forums don't show it good, *** ******. Anyways, check these lines.