Loose Indentation
#1

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]
Reply
#2

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.
Reply
#3

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!
Reply
#4

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?
Reply
#5

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

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.
Reply
#7

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
Reply
#8

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!
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)