Raised This Month: $ Target: $400
 0% 

Trouble With Indenting the Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-26-2016 , 11:59   Trouble With Indenting the Code
Reply With Quote #1

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.

Last edited by siriusmd99; 05-26-2016 at 12:07.
siriusmd99 is offline
Senzor
Member
Join Date: Nov 2012
Location: Romania
Old 05-26-2016 , 12:04   Re: Trouble With Indenting the Code
Reply With Quote #2

It gives no error to me.
Senzor is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-26-2016 , 12:10   Re: Trouble With Indenting the Code
Reply With Quote #3

Quote:
Originally Posted by Senzor View Post
It gives no error to me.
Because :

Quote:
Originally Posted by siriusmd99 View Post
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.
siriusmd99 is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 05-26-2016 , 12:52   Re: Trouble With Indenting the Code
Reply With Quote #4

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.
__________________

Last edited by gabuch2; 05-26-2016 at 12:53.
gabuch2 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-26-2016 , 12:52   Re: Trouble With Indenting the Code
Reply With Quote #5

Then attach your code as the forum converts tabs to spaces when you paste it in.
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-26-2016 , 19:56   Re: Trouble With Indenting the Code
Reply With Quote #6

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).
__________________
fysiks is offline
Reply



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

Forum Jump


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


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