SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 09/07/2010, 02:26 PM   #1
Master™
Huge Clucker
 
Master™'s Avatar
 
Join Date: Jul 2010
Location: Chicago, IL
Posts: 268
Reputation: 0
Default Loose Indentation

I have a loose indention I need help with

Code:
                                            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]
__________________
~~REST IN PEACE <3 You will stay in my heart <3~~
Master™ is offline  
Old 09/07/2010, 02:27 PM   #2
[XST]O_x
High-roller
 
[XST]O_x's Avatar
 
Join Date: Aug 2009
Posts: 1,960
Reputation: 94
Default Re: Loose Indentation

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.
[XST]O_x is offline  
Old 09/07/2010, 02:28 PM   #3
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,896
Reputation: 118
Default Re: Loose Indentation

This is one of the examples:
pawn Code:
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!
Grim_ is offline  
Old 09/07/2010, 02:28 PM   #4
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: Loose Indentation

No idea but I do see some unreachable code:

pawn Code:
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?
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline  
Old 09/07/2010, 02:28 PM   #5
Cameltoe
High-roller
 
Cameltoe's Avatar
 
Join Date: Apr 2010
Location: Norway
Posts: 1,741
Reputation: 24
Default Re: Loose Indentation

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

Quote:
Originally Posted by Cameltoe View Post
Share the progress so others who are looking for the same also find's their answer.
Quote:
Originally Posted by teomakedonija View Post
ahaha i don't want
Rep++;
Cameltoe is offline  
Old 09/07/2010, 02:30 PM   #6
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,594
Reputation: 69
Default Re: Loose Indentation

Add: #pragma tabsize 0

This will ignore the indention.



To explain it:

pawn Code:
Test
Test
Test
  Test
Test

pawn Code:
Test
Test
Test
Test
Test


1st will give you wanring, 2nd not.
__________________
Jeffry is offline  
Old 09/07/2010, 02:36 PM   #7
Master™
Huge Clucker
 
Master™'s Avatar
 
Join Date: Jul 2010
Location: Chicago, IL
Posts: 268
Reputation: 0
Default Re: Loose Indentation

Quote:
Originally Posted by Jeffry View Post
Add: #pragma tabsize 0

This will ignore the indention.



To explain it:

pawn Code:
Test
Test
Test
  Test
Test

pawn Code:
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
__________________
~~REST IN PEACE <3 You will stay in my heart <3~~
Master™ is offline  
Old 09/07/2010, 02:37 PM   #8
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,896
Reputation: 118
Default Re: Loose Indentation

Quote:
Originally Posted by LucoC View Post
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!
Grim_ is offline  
Old 09/07/2010, 02:39 PM   #9
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,594
Reputation: 69
Default Re: Loose Indentation

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.
__________________
Jeffry is offline  
Old 09/07/2010, 02:41 PM   #10
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: Loose Indentation

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

pawn Code:
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.
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
loose Indentation Tnt12340 Help Archive 8 12/06/2010 09:49 PM
loose indentation by_karizma Help Archive 3 12/06/2010 07:30 PM
Loose Indentation goantonio101 Help Archive 4 08/06/2010 06:34 AM
Loose Indentation Juanxz Help Archive 8 23/01/2010 09:44 PM


All times are GMT. The time now is 05:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.