Loose Indentation
#1

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;
}
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

Fixed
Reply
#5

Just arrange your code dude. USE TAB on your keyboard.
Reply
#6

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.
Reply
#7

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)