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=134455)

Ludacriss 08-04-2010 21:10

Loose Indentation
 
Why do i get the error: Loose Indentation on line 2859 and 2864

PHP Code:

public respawn_sapitem(id)
{
    if (
is_user_alive(id))
    {
        if (
has_chicken[id] == true)
        {
            
give_item(id"weapon_mac10")
        }
        
        if (
has_john[id] == true)
        {
            
give_item(id"weapon_fiveseven")
        }
        
        if (
has_tactical[id] == true)
        {
            
give_item(id"weapon_m3")
        }
    
        if (
has_dynamic[id] == true)    
        {
            
give_item(id"weapon_deagle")
        }
    }



nikhilgupta345 08-04-2010 21:15

Re: Loose Indentation
 
Which lines are 2859 and 2864??

Ludacriss 08-04-2010 21:16

Re: Loose Indentation
 
PHP Code:

if (has_john[id] == true

2859

And

2864
PHP Code:

if (has_tactical[id] == true

Everything worked before i added

PHP Code:

        if (has_john[id] == true)
        {
            
give_item(id"weapon_fiveseven")
        } 


nikhilgupta345 08-04-2010 21:19

Re: Loose Indentation
 
Code:

public respawn_sapitem(id)
{
    if (is_user_alive(id))
    {
    if (has_chicken[id] == true)
        {
        give_item(id, "weapon_mac10")
        }
       
    if (has_john[id] == true)
        {
        give_item(id, "weapon_fiveseven")
        }
       
    if (has_tactical[id] == true)
        {
        give_item(id, "weapon_m3")
        }
   
    if (has_dynamic[id] == true)   
        {
        give_item(id, "weapon_deagle")
        }
    }
}

Try replacing that in and see if it works.

Ludacriss 08-04-2010 21:21

Re: Loose Indentation
 
Ty Man! It worked! What did u change?

nikhilgupta345 08-04-2010 21:25

Re: Loose Indentation
 
The if's were indented with spaces, so i indented them with tab. I did that for give_item also. Also, loose indentations are just warnings, usually not gonna mess up the plugin or anything, it'll still work. But just makes it more neat :D

Ludacriss 08-04-2010 21:54

Re: Loose Indentation
 
Aha ok man ty :)

fysiks 08-04-2010 23:12

Re: Loose Indentation
 
@Ludariss, if you just copy the code that you posted here and replace the original with it then I bet it will work.

Quote:

Originally Posted by nikhilgupta345 (Post 1261944)
The if's were indented with spaces, so i indented them with tab. I did that for give_item also. Also, loose indentations are just warnings, usually not gonna mess up the plugin or anything, it'll still work. But just makes it more neat :D

First of all, your indentation is horrible. Second, anything copied from this forum by highlighting it will give you all spaces regardless of how you have it in your text editor.


The OP's indentation is perfect but what is causing the warning is likely the combination of spaces and tabs.

Ludacriss 08-05-2010 09:11

Re: Loose Indentation
 
It's not my whole code it's made by Vechta.

mottzi 08-05-2010 09:16

Re: Loose Indentation
 
if(blabla)
{
// here press Tab
}

My Eyes get sick when i see this kind of horrible codeindentation


All times are GMT -4. The time now is 00:17.

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