Need Help
#1

Can someone fix this for me?
It gives loose identation warning.

pawn Код:
if (c == 0) return SendClientMessage(playerid, -1, ""STEELBLUE"SERVER: There are no donators/premiums online.");
    ShowPlayerDialog(playerid, DIALOG_VIPS, DIALOG_STYLE_MSGBOX, ""RED"Premium/Donators Online:", str, "OK", "");
    return 1;
}
Reply
#2

Show us a bit more code? I don't know what's up or down :L
Reply
#3

Код:
    if (c == 0) return SendClientMessage(playerid, -1, ""STEELBLUE"SERVER: There are no donators/premiums online.");
    ShowPlayerDialog(playerid, DIALOG_VIPS, DIALOG_STYLE_MSGBOX, ""RED"Premium/Donators Online:", str, "OK", "");
    return 1;
}
EDIT: From SAMP wiki
217: loose indentation

The compiler will issue this warning if the code indentation is 'loose', example:

Good:
Код:
if(condition)
{
    action();
    result();
}
Bad:
Код:
if(condition)
{
    action();
  result();
}
Indentation means to push (indent) text along from the left of the page (by pressing the TAB key). This is common practice in programming to make code easier to read. This warning also exists to avoid dangling-else problem.
Reply
#4

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
Show us a bit more code? I don't know what's up or down :L
Heres The Full Command
pawn Код:
CMD:premiums ( playerid )
{
     new c = 0, str[128];
     if ( PlayerInfo[playerid][LoggedIn] == 0 ) return SendClientMessage( playerid, -1, ""RED"ERROR: "GREY"You must be logged in!");
     for (new i = 0; i < MAX_PLAYERS; i++)
     {
         if (IsPlayerConnected(i))
         {
             if (PlayerInfo[i][VIP] >= 1)
             {
                 c++;
                 if (c==1)
                 {
                    format(str, sizeof(str), ""REDORANGE"Premium member(s)/donators online:\n{%06x}%s(%d)\n", (GetPlayerColor(i) >>> 8), GetName(i), i);
                 }
                 if (c >=2)
                 {
                    format(str, sizeof(str), "\n%s{%06x}%s(%d)", str, (GetPlayerColor(i) >>> 8), GetName(i), i);
                 }
            }
        }
    }
    if (c == 0) return SendClientMessage(playerid, -1, ""STEELBLUE"SERVER: There are no donators/premiums online.");
    ShowPlayerDialog(playerid, DIALOG_VIPS, DIALOG_STYLE_MSGBOX, ""RED"Premium/Donators Online:", str, "OK", "");
    return 1;
}
Reply
#5

pawn Код:
CMD:premiums ( playerid )
{
    new c = 0, str[128];
    if ( PlayerInfo[playerid][LoggedIn] == 0 ) return SendClientMessage( playerid, -1, ""RED"ERROR: "GREY"You must be logged in!");
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (PlayerInfo[i][VIP] >= 1)
            {
                c++;
                if (c==1)
                {
                    format(str, sizeof(str), ""REDORANGE"Premium member(s)/donators online:\n{%06x}%s(%d)\n", (GetPlayerColor(i) >>> 8), GetName(i), i);
                }
                if (c >=2)
                {
                    format(str, sizeof(str), "\n%s{%06x}%s(%d)", str, (GetPlayerColor(i) >>> 8), GetName(i), i);
                }
            }
        }
    }
    if (c == 0) return SendClientMessage(playerid, -1, ""STEELBLUE"SERVER: There are no donators/premiums online.");
    ShowPlayerDialog(playerid, DIALOG_VIPS, DIALOG_STYLE_MSGBOX, ""RED"Premium/Donators Online:", str, "OK", "");
    return 1;
}
Reply
#6

OMG Rudy_ . You are Genius !
+Rep for you ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)