Warning -
Counterafk - 04.10.2015
I dont even know if its supposed to be lined up like this, anyhow please correct my code
Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
SetPlayerPos(playerid, 768.1497,-29.3624,1000.5859);
SetPlayerFacingAngle(playerid, 180.000);
SetPlayerInterior(playerid,6);
SetPlayerColor(playerid, 0x9f9f9f);
// ApplyAnimation(playerid, "GANGS", "leanIDLE", 4.1, 1, 1, 1, 0, 1, 1);
}
if( gDMRotation[playerid] ) //if he enables it
{
JoinRandomRotation(playerid);
SetTimerEx("Joinspawnprotection", 3000, false, "i", playerid);
}
else
{
SetPlayerPos(playerid, 774.1058, -49.5124, 1000.5859);
SetPlayerFacingAngle(playerid, 359.2367);
SetPlayerInterior(playerid,6);
SetPlayerColor(playerid, 0x9f9f9f);
}
return 1;
}
Код:
\gamemodes\bare.pwn(151) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
Re: Warning -
Jefff - 04.10.2015
pawn Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
SetPlayerPos(playerid, 768.1497,-29.3624,1000.5859);
SetPlayerFacingAngle(playerid, 180.000);
SetPlayerInterior(playerid,6);
SetPlayerColor(playerid, 0x9f9f9f);
// ApplyAnimation(playerid, "GANGS", "leanIDLE", 4.1, 1, 1, 1, 0, 1, 1);
}
if( gDMRotation[playerid] ) //if he enables it
{
JoinRandomRotation(playerid);
SetTimerEx("Joinspawnprotection", 3000, false, "i", playerid);
}
else
{
SetPlayerPos(playerid, 774.1058, -49.5124, 1000.5859);
SetPlayerFacingAngle(playerid, 359.2367);
SetPlayerInterior(playerid,6);
SetPlayerColor(playerid, 0x9f9f9f);
}
return 1;
}
Re: Warning -
Sew_Sumi - 04.10.2015
Warnings are just that. They don't stop the compile, and it'd "work".
Indentation and code structure is important, and very simple. Especially if you start using it early, and making sure you use it at all times.
Re: Warning -
AbyssMorgan - 04.10.2015
Example of why we should use the exact indentation
Код:
function(a,b,c,d,e,f){
if(a > 0){
//'a' are greater than zero
if(b > 0){
//'a, b' are greater than zero
if(c > 0){
//'a, b, c' are greater than zero
if(d > 0){
//'a, b, c, d' are greater than zero
if(e > 0){
//'a, b, c, d, e' are greater than zero
if(f > 0){
//all variables are greater than zero
} else {
//'f' is not greater than zero
}
} else {
//'e' is not greater than zero
}
} else {
//'d' is not greater than zero
}
} else {
//'c' is not greater than zero
}
} else {
//'b' is not greater than zero
}
} else {
//'a' is not greater than zero
}
}
your warring is the fact that the elements do not have equal indentation