CMD:game(playerid, params[])
{
OnBoard[playerid] = true;
new str[2056], str2[2056], GameStatusStr[48], JoinedPlayerStr[24][48];
switch(GameStatus)
{
case 0: GameStatusStr = "{33CC33}Ready for play! (/ready)";
case 1: GameStatusStr = "{FF0000}Starting...";
case 2: GameStatusStr = "{FFFFFF}In Progress...";
case 3: GameStatusStr = "{DDDD00}Finished! Resetting...";
case 4: GameStatusStr = "{FF0000}! LOCKED !";
}
for(new i=0; i<24; i++)
{
if(JoinedPlayer[i] == -1) format(JoinedPlayerStr[i], 48, "{AAAAAA}===", GetName(JoinedPlayer[i]));
else
{
new Float:Health;
GetPlayerHealth(JoinedPlayer[i], Health);
switch(Health)
{
case 90..100: format(JoinedPlayerStr[i], 48, "{33CC33}%s", GetName(JoinedPlayer[i]));
case 70..89: format(JoinedPlayerStr[i], 48, "{99CC00}%s", GetName(JoinedPlayer[i]));
case 50..69: format(JoinedPlayerStr[i], 48, "{DDDD00}%s", GetName(JoinedPlayer[i]));
case 20..49: format(JoinedPlayerStr[i], 48, "{FF6600}%s", GetName(JoinedPlayer[i]));
case 1..19: format(JoinedPlayerStr[i], 48, "{FF0000}%s", GetName(JoinedPlayer[i]));
case 0: format(JoinedPlayerStr[i], 48, "{AAAAAA}%s", GetName(JoinedPlayer[i]));
}
}
}
strcat(str, "Game Status: %s\n---------------------------------------------------\n");
strcat(str, "%s\t%s\t%s\t%s\n");
strcat(str, "%s\t%s\t%s\t%s\n");
strcat(str, "%s\t%s\t%s\t%s\n");
strcat(str, "%s\t%s\t%s\t%s\n");
strcat(str, "%s\t%s\t%s\t%s\n");
strcat(str, "%s\t%s\t%s\t%s");
format(str2, sizeof(str2), str, GameStatusStr, JoinedPlayerStr[0], JoinedPlayerStr[1], JoinedPlayerStr[2], JoinedPlayerStr[3], JoinedPlayerStr[4], JoinedPlayerStr[5], JoinedPlayerStr[6], JoinedPlayerStr[7], JoinedPlayerStr[8], JoinedPlayerStr[9], JoinedPlayerStr[10], JoinedPlayerStr[11], JoinedPlayerStr[12], JoinedPlayerStr[13], JoinedPlayerStr[14], JoinedPlayerStr[15], JoinedPlayerStr[16], JoinedPlayerStr[17], JoinedPlayerStr[18], JoinedPlayerStr[19], JoinedPlayerStr[20], JoinedPlayerStr[21], JoinedPlayerStr[22], JoinedPlayerStr[23]);
return ShowPlayerDialog(playerid, GAME_DIALOG, DIALOG_STYLE_TABLIST, "The Hunger Games 2015", str2, "Close", "");
}
strcat(str, GameStatusStr);
strcat(str, "\t");
strcat(str, JoinedPlayerStr[0]);
...
CMD:game(playerid, params[])
{
OnBoard[playerid] = true;
new JoinedPlayerStr[35], str[950] = "Game Status: ";
switch(GameStatus)
{
case 0: strcat(str, "{33CC33}Ready for play! (/ready)");
case 1: strcat(str, "{FF0000}Starting...");
case 2: strcat(str, "{FFFFFF}In Progress...");
case 3: strcat(str, "{DDDD00}Finished! Resetting...");
case 4: strcat(str, "{FF0000}! LOCKED !");
}
strcat(str, "\n---------------------------------------------------\n");
for(new i = 0; i < 24; i++)
{
if(!IsPlayerConnected(JoinedPlayer[i])) continue;
new colorstring[7] = "AAAAAA";
if(JoinedPlayer[i] != -1)
{
new Float:Health;
GetPlayerHealth(JoinedPlayer[i], Health);
if(90.0 <= Health <= 100.0) colorstring = "33CC33";
else if(70.0 <= Health < 90.0) colorstring = "99CC00";
else if(50.0 <= Health < 70.0) colorstring = "DDDD00";
else if(20.0 <= Health < 50.0) colorstring = "FF6600";
else if(0.0 < Health < 20.0) colorstring = "FF0000";
}
format(JoinedPlayerStr, sizeof(JoinedPlayerStr), (!((i + 1) % 4) && i != 23) ? ("{%s}%s\n") : ("{%s}%s\t"), colorstring, GetName(JoinedPlayer[i]));
strcat(str, JoinedPlayerStr);
}
return ShowPlayerDialog(playerid, GAME_DIALOG, DIALOG_STYLE_TABLIST, "The Hunger Games 2015", str, "Close", "");
}
That ^, and here:
pawn Код:
|
!((i + 1) % 4)
format(JoinedPlayerStr, sizeof(JoinedPlayerStr), (!((i + 1) % 4) && i != 23) ? ("{%s}%s\n") : ("{%s}%s\t"), colorstring, GetName(JoinedPlayer[i]));
if(!((i + 1) % 4) && i != 23) format(JoinedPlayerStr, sizeof(JoinedPlayerStr), "{%s}%s\n", colorstring, GetName(JoinedPlayer[i]));
else format(JoinedPlayerStr, sizeof(JoinedPlayerStr), "{%s}%s\t", colorstring, GetName(JoinedPlayer[i]));
format(str2, sizeof(str2), str, GameStatusStr, JoinedPlayerStr[0], JoinedPlayerStr[1], JoinedPlayerStr[2], JoinedPlayerStr[3], JoinedPlayerStr[4], JoinedPlayerStr[5], JoinedPlayerStr[6], JoinedPlayerStr[7], JoinedPlayerStr[8], JoinedPlayerStr[9], JoinedPlayerStr[10], JoinedPlayerStr[11], JoinedPlayerStr[12], JoinedPlayerStr[13], JoinedPlayerStr[14], JoinedPlayerStr[15], JoinedPlayerStr[16], JoinedPlayerStr[17], JoinedPlayerStr[18], JoinedPlayerStr[19], JoinedPlayerStr[20], JoinedPlayerStr[21], JoinedPlayerStr[22], JoinedPlayerStr[23]);