AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   loose indentation (https://forums.alliedmods.net/showthread.php?t=48888)

geertjan88 12-22-2006 17:27

loose indentation
 
I get a lot of loose indentation errors and i want to remove them couse after a compile it is really hard to see how it went i just want 0 warnings and 0 errors.
For example this gives an warning loose indentation:

Code:

public leet_control_laptop(id,key)
{       
        switch(key)
        {
                case 0:
                {
                        pdbackdoorA(id)
                        leet_control_laptop_show(id)
                }
                case 1:
                {
                        pdjaildoorA(id)
                        leet_control_laptop_show(id)
                }
                case 2:
                {
                        jaildoor1A(id)
                        leet_control_laptop_show(id)
                }
                case 3:
                {
                        jaildoor2A(id)
                        leet_control_laptop_show(id)
                }
                case 4:
                {
                        jaildoor3A(id)
                        leet_control_laptop_show(id)
                }
        }
return PLUGIN_HANDLED
}

The compiler says it is in the rule where "return PLUGIN_HANDLED" is.

Emp` 12-22-2006 17:37

Re: loose indentation
 
loose indentation is just a warning (and does not affect the code). all it really wants is that you line up your lines. your return line should have the same amount of tabs/spaces as the bracket before it.

AMXX studio has a command to do this for you.

edit:

so instead of code looking like this
Code:

        public zomg2_checker()
{
if(blah_blah)
{
        happy = true
                zomg = false
}
        if(zomg)
zomg2 = true
}

it should be
Code:

public zomg2_checker()
{
        if(blah_blah)
        {
                happy = true
                zomg = false
        }
        if(zomg)
                zomg2 = true
}


geertjan88 12-22-2006 17:40

Re: loose indentation
 
Well thanks. But what is the command and what for example wrong in the code i posted?

Emp` 12-22-2006 17:44

Re: loose indentation
 
[img]http://img321.**************/img321/5862/indenttoolvn9.jpg[/img]

and as i previously stated, your return line should have as many spaces/tabs as the line before it:
Code:

public leet_control_laptop(id,key)
{       
        switch(key)
        {
                case 0:
                {
                        pdbackdoorA(id)
                        leet_control_laptop_show(id)
                }
                case 1:
                {
                        pdjaildoorA(id)
                        leet_control_laptop_show(id)
                }
                case 2:
                {
                        jaildoor1A(id)
                        leet_control_laptop_show(id)
                }
                case 3:
                {
                        jaildoor2A(id)
                        leet_control_laptop_show(id)
                }
                case 4:
                {
                        jaildoor3A(id)
                        leet_control_laptop_show(id)
                }
        }
        return PLUGIN_HANDLED
}


geertjan88 12-22-2006 17:58

Re: loose indentation
 
sorry i am not english i don't understand "and as i previously stated, your return line should have as many spaces/tabs as the line before it"

SweatyBanana 12-22-2006 18:58

Re: loose indentation
 
This character: {

and

This character: }

should be the same amount of spaces from the left side of the page.


IN DUTCH:

Dit teken: {

En

Dit teken: }

Zou de zelfde hoeveelheid van ruimtes van de linkerzijde van de pagina moeten zijn.

Throstur 12-22-2006 20:48

Re: loose indentation
 
Sweet, gotta get amxx studio, been using crimson (the best imo anyways, but still, nice to have amxx files)

Simon Logic 12-23-2006 15:53

Re: loose indentation
 
I love #pragma tabsize N
=)


All times are GMT -4. The time now is 22:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.