Loose Indentation - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Loose Indentation (
/showthread.php?tid=546204)
Loose Indentation -
ScriptFohLife - 13.11.2014
Anyone know how to fix this please?
Код:
(44) : warning 217: loose indentation
(45) : warning 217: loose indentation
(47) : warning 217: loose indentation
pawn Код:
CMD:gr(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
return 1;
}
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not driving a vehicle.");
AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
SendClientMessage(playerid, COLOR_YELLOW, "Gold Rims added on your Vehicle!");
return 1;
}
Re: Loose Indentation -
DavidBilla - 13.11.2014
pawn Код:
CMD:gr(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not driving a vehicle.")
AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
SendClientMessage(playerid, COLOR_YELLOW, "Gold Rims added on your Vehicle!");
return 1;
}
Re: Loose Indentation -
Kwarde - 13.11.2014
It kinda means your code looks messy.
pawn Код:
//Bad indentation:
CMD:mycommand(playerid, params[])
{
if (IsPlayerAdmin(playerid)){
SendClientMessage(playerid, -1, "Hello RCON admin!");
return 1;
} //This one; it should be at the same vertical line as the if statement
SendClientMessage(playerid, -1, "Hello player!"); //Samewise..
return 1;
}
//Good indentation:
CMD:mycommand(playerid, params[])
{
if (IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, -1, "Hello RCON admin!");
return 1;
}
SendClientMessage(playerid, -1, "Hello player!");
return 1;
}
By the way,
1- it is really not needed to check if the player is online or not.. if a player is offline they cannot use the command thus it will not be called
2- your command stops (returning 1) if the player using the command is online, so you'll never be able to use that command
EDIT:
@David{somethingelse};
Please consider explaining WHY he had the warning. If you don't explain what was wrong, they'll never learn.
Re: Loose Indentation -
ScriptFohLife - 13.11.2014
Fixed
Re: Loose Indentation -
Runn3R - 13.11.2014
Just arrange your code dude. USE TAB on your keyboard.
Re: Loose Indentation -
Kwarde - 13.11.2014
Are you fucking kidding me? I just clearly explained what was wrong and DavidBilla gave you a code that was just like it should be (the indentation) and you just screw it up again.. I'm not even gonna try anymore to help you. Good luck.
EDIT:
The post I commented to has been editted to "Fixed", so this post now seems weird.
Re: Loose Indentation -
HeLiOn_PrImE - 14.11.2014
You know, there are websites that have text indenting tools? Just paste an entire GM and it will indent it for you. No code modification. Basically no matter how many of those warnings you get, they will get rid of them all. Just ****** it, you'll see!