Код:
if(!strcmp(sub_cmd, "joinmsg"))
{
switch (Player[playerid][JoinMsg])
{
case 0:
{
Player[playerid][JoinMsg] = 1;
SCM(playerid, COLOR_YELLOW, "* You have enabled join messages.");
}
case 1:
{
Player[playerid][JoinMsg] = 0;
SCM(playerid, COLOR_YELLOW, "* You have disabled join messages.");
}
}
}
16 lines.
Код:
if(!strcmp(sub_cmd, "joinmsg"))
{
if(Player[playerid][JoinMsg])
{
Player[playerid][JoinMsg] = 0;
SCM(playerid, COLOR_YELLOW, "* You have disabled join messages.");
}
else
{
Player[playerid][JoinMsg] = 1;
SCM(playerid, COLOR_YELLOW, "* You have enabled join messages.");
}
}
13 lines.
Код:
if(!strcmp(sub_cmd, "joinmsg"))
{
Player[playerid][JoinMsg] = !Player[playerid][JoinMsg];
if(Player[playerid][JoinMsg])
{
SCM(playerid, COLOR_YELLOW, "* You have enabled join messages.");
}
else
{
SCM(playerid, COLOR_YELLOW, "* You have disabled join messages.");
}
}
12 lines.
Код:
if(!strcmp(sub_cmd, "joinmsg"))
{
if((Player[playerid][JoinMsg] = !Player[playerid][JoinMsg]))
{
SCM(playerid, COLOR_YELLOW, "* You have enabled join messages.");
}
else
{
SCM(playerid, COLOR_YELLOW, "* You have disabled join messages.");
}
}
11 lines.
Код:
if(!strcmp(sub_cmd, "joinmsg"))
{
SCM(playerid, COLOR_YELLOW, (Player[playerid][JoinMsg] = !Player[playerid][JoinMsg]) ? ("* You have enabled join messages.") : ("* You have disabled join messages."));
}
4 lines.
Код:
if(!strcmp(sub_cmd, "joinmsg")) SCM(playerid, COLOR_YELLOW, (Player[playerid][JoinMsg] = !Player[playerid][JoinMsg]) ? ("* You have enabled join messages.") : ("* You have disabled join messages."));
1 line.
Код:
if(!strcmp(sub_cmd, "joinmsg")){switch (Player[playerid][JoinMsg]){case 0:{Player[playerid][JoinMsg] = 1;SCM(playerid, COLOR_YELLOW, "* You have enabled join messages.");}case 1:{Player[playerid][JoinMsg] = 0;SCM(playerid, COLOR_YELLOW, "* You have disabled join messages.");}}}
But this would also be one line. The right balance between legibility and compactness is somewhere in the middle.