AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trouble With Indenting the Code (https://forums.alliedmods.net/showthread.php?t=283140)

siriusmd99 05-26-2016 11:59

Trouble With Indenting the Code
 
I don't really understand , I indented the code and anyway it's showing warning on compiler.

PHP Code:

#include <amxmodx>

new MAP[] = "mapname";

public 
plugin_precache()
{

    new 
MapName[64]; get_mapname(MapName63);
    
    if(!
equal(MapNameMAP))
    {
    
        
formatexMapName127"Invalid Map, it should be: %s"MAP );
        
set_fail_stateMapName );
        
    }else{
    
        
server_cmd("mp_timelimit 9999");
        
server_cmd("mp_startmoney 16000");
        
    }
    


P.S. LOL!, pasted here in my post after that copied back to .sma, compiled and no warning.
Can someone explain wtf is happening?
Maybe something wrong with notepad , with spaces , encoding ... Really don't understand...

P.S. 2. If someone wants to ask why i didn't read tutorials then I'll say that i found only one simple tutorial . Maybe there are others which obviously exist but there's something wrong with searching engine and i haven't found anything.

Senzor 05-26-2016 12:04

Re: Trouble With Indenting the Code
 
It gives no error to me.

siriusmd99 05-26-2016 12:10

Re: Trouble With Indenting the Code
 
Quote:

Originally Posted by Senzor (Post 2422176)
It gives no error to me.

Because :

Quote:

Originally Posted by siriusmd99 (Post 2422172)
P.S. LOL!, pasted here in my post after that copied back to .sma, compiled and no warning.
Can someone explain wtf is happening?
Maybe something wrong with notepad , with spaces , encoding ... Really don't understand...

After copying back script from post to notepad and comiling it doesnt show warnings. It's very weird.

gabuch2 05-26-2016 12:52

Re: Trouble With Indenting the Code
 
Copy and Paste between forums and text editors like to fuck up with the spacing. (replacing TAB with spaces, for example)

Check the line that's causing problems, it will give a warning if it's indented with spaces, rather than tabs.

klippy 05-26-2016 12:52

Re: Trouble With Indenting the Code
 
Then attach your code as the forum converts tabs to spaces when you paste it in.

fysiks 05-26-2016 19:56

Re: Trouble With Indenting the Code
 
If your code "looks" like it's indented and it still gives warnings then you are mixing tabs and spaces. For indentation, you should use one or the other, not both.

Use Notepad++ and you can turn on non-printable characters and you'll see where there are spaces (dots) and where there are tabs (arrows).


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

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