[Tutorial] How to fix warning 217: loose indentation
#21

Quote:
Originally Posted by Christian7073
View Post
you can use
#pragma tabsize 0
Quote:
Originally Posted by sonnkz
View Post
i in this problem use #pragma tabsize 0 and solved problems with Loose identation
Fix this, then:
Code:
#include <a_samp>

public OnFilterScriptInit()
{
new iVar, iVar2, iVar3;
//some magical way of assigning data to the variables from any sort of input
if(iVar == iVar2)
{
if(iVar2 == iVar3)
{
if(iVar == iVar3)
{
print("they're all equal!");
}
}
}
}
}
From that I can't see what's wrong (although I do know what's wrong obviously). However, from this:
Code:
#include <a_samp>

public OnFilterScriptInit()
{
	new iVar, iVar2, iVar3;
	//some magical way of assigning data to the variables from any sort of input
	if(iVar == iVar2)
	{
		if(iVar2 == iVar3)
		{
			if(iVar == iVar3)
			{
				print("they're all equal!");
			}
		}
	}
	}
}
That is exactly why you should indent rather than using your #pragma tabsize directive. (It's also why I refuse to help people with ridiculous indentation)

On topic - this is a good tutorial, but some people are too ignorant to listen because "the #pragma tabsize exists so we don't need this lololol"...
Reply
#22

If I was Kye I'd remove the fucking thing so people are FORCED to indent. In fact I'd change the WARNING to an ERROR.
Reply
#23

Quote:
Originally Posted by MP2
View Post
If I was Kye I'd remove the fucking thing so people are FORCED to indent. In fact I'd change the WARNING to an ERROR.
I Agree with you MP2
Reply
#24

help me fix this
Quote:

C:\Users\Admin\Downloads\Compressed\LSLRP 0.3e\gamemodes\lslrp.pwn(4600) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	    new str[30];
	    format(str,sizeof(str),"~W~%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
	    GameTextForPlayer(playerid, str, 1000, 1);
	    
		if(gTeam[playerid] >= 3)
		{
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3) {}
		    else { SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle"); }
		}
		if (IsALSFMD(vehicleid) && !ispassenger)
		{
		    if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
		    else { SetPlayerCriminal(playerid,255, "Stealing An Ambulance"); }
		}
	}
            return 1;
Reply
#25

Y_Less we can even use this code right

<removed>
Reply
#26

Quote:
Originally Posted by maaz
View Post
Y_Less we can even use this code right

<removed>
Worst method. Indentation is important!
Reply
#27

its easy for the newbies right ??
Reply
#28

Quote:
Originally Posted by maaz
View Post
Y_Less we can even use this code right

<removed>
From the forum rules:

Quote:
  • Banned Code - There is a certain "#pragma" that can be used to hide significant warnings and produce unreadable code - DO NOT advocate its use if you know what it is; it is TERRIBLE practice and we want to get rid of it.
So, in short - no! In fact, if you had read any of my other posts in this topic you would have seen the same stated quite clearly and repeatedly.

Quote:
Originally Posted by maaz
View Post
its easy for the newbies right ??
Just because something is easy does not mean it is good or should be done. If you are only concerned with ease stop scripting right now - that is the easiest path.
Reply
#29

Thanks For That and even sorry
I was thinking that this is correct way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)