AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Scripting Help Whats Wrong With my code (https://forums.alliedmods.net/showthread.php?t=282381)

pupdebox 05-05-2016 13:03

Scripting Help Whats Wrong With my code
 
its giving me warning 217: loose indentation i have also added new tekrar = 1 at the beginning of plugin
Code:

        case 6: {
                if(tekrar >= 4)
                {
                tekrar = 1
                }
            switch( tekrar )
                            {
                case 1 : {
                        client_cmd(0, "mp3 play sound/mp3/monsterx.mp3")
                        tekrar += 1
                        }
                case 2 : {client_cmd(0, "mp3 play sound/mp3/heavenx.mp3")
                        tekrar += 1
                          }
                case 3 : {client_cmd(0, "mp3 play sound/mp3/patliyoherkesx.mp3")
                        tekrar += 1
                        }
                        }
                }


Michael Shoe Maker 05-05-2016 13:45

Re: Scripting Help Whats Wrong With my code
 
It's to do with your indentation of your code, make sure there's no spaces etc.
PHP Code:

    case 6:
    {
        if(
tekrar >= 4)
        {
            
tekrar 1
        
}
        switch( 
tekrar )
        {
            case 
:
            {
                
client_cmd(0"mp3 play sound/mp3/monsterx.mp3")
                
tekrar += 1
            
}
            case 
:
            {
                
client_cmd(0"mp3 play sound/mp3/heavenx.mp3")
                
tekrar += 1
            
}
            case 
:
            {
                
client_cmd(0"mp3 play sound/mp3/patliyoherkesx.mp3")
                
tekrar += 1
            
}
        }
    } 


siriusmd99 05-05-2016 13:58

Re: Scripting Help Whats Wrong With my code
 
Quote:

Originally Posted by pupdebox (Post 2416959)
its giving me warning 217: loose indentation i have also added new tekrar = 1 at the beginning of plugin
Code:

        case 6: {
                if(tekrar >= 4)
                {
                tekrar = 1
                }
            switch( tekrar )
                            {
                case 1 : {
                        client_cmd(0, "mp3 play sound/mp3/monsterx.mp3")
                        tekrar += 1
                        }
                case 2 : {client_cmd(0, "mp3 play sound/mp3/heavenx.mp3")
                        tekrar += 1
                          }
                case 3 : {client_cmd(0, "mp3 play sound/mp3/patliyoherkesx.mp3")
                        tekrar += 1
                        }
                        }
                }



It doesnt affect your code. This is not an error , but if you feel unconfortable you use indenter tool from amxx studio.

pupdebox 05-05-2016 14:11

Re: Scripting Help Whats Wrong With my code
 
Thx man im newbie and i use notepad :D i will download studio now

fysiks 05-05-2016 20:29

Re: Scripting Help Whats Wrong With my code
 
Quote:

Originally Posted by pupdebox (Post 2416982)
Thx man im newbie and i use notepad :D i will download studio now

I'd recommend against AMXX Studio. It has bugs. I'd recommend Notepad++ or other mature source code editor.

If you learn how to properly indent code, you'll never need a program to do it for you. However, if you really do need to do it (in Notepad++), you can use the TextFX (TextFX Edit > Reindent C++ code) plugin.


All times are GMT -4. The time now is 18:40.

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