SA-MP Forums Archive
Need Help - 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: Need Help (/showthread.php?tid=541485)



Need Help - Jdt - 12.10.2014

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;
}



Re: Need Help - Rudy_ - 12.10.2014

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


Re: Need Help - dominik523 - 12.10.2014

Код:
    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.


Re: Need Help - Jdt - 12.10.2014

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;
}



Re: Need Help - Rudy_ - 12.10.2014

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;
}



Re: Need Help - Jdt - 12.10.2014

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