Code:
public CmdPlayerInfo(id) {
new iMenu = menu_create("\d[Achievements]\y Hide 'N' Seek^n\rBy SnusMumrikeN\y", "handlePlayerMenu");
new iPlayers[32], iNum, iPlayer, szName[32], szKey[4];
get_players(iPlayers, iNum);
new szMenuKey[128];
for( new i; i < iNum; i++ )
{
iPlayer = iPlayers[i];
new percent = 100 * iAchLevel[id][i]/iAchPoints[i]
get_user_name(iPlayer, szName, charsmax(szName));
format(szMenuKey,127,"\r%s \d[%d%%] ^n\w",szName,percent);
num_to_str(iPlayer, szKey, charsmax(szKey));
menu_additem(iMenu, szMenuKey, szKey);
}
menu_setprop(iMenu, MPROP_EXITNAME, "Exit");
menu_display(id, iMenu, 0);
}
public handlePlayerMenu(id, iMenu, iItem)
{
if( iItem == MENU_EXIT )
{
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
new szData[6], iAccess, iCallback;
menu_item_getinfo(iMenu, iItem, iAccess, szData, charsmax(szData), _, _, iCallback);
new i = str_to_num(szData);
new szAuth[35], szName[32];
get_user_authid(i, szAuth, charsmax(szAuth));
get_user_name(i, szName, charsmax(szName));
static szMotd[30000];
new iLen = formatex(szMotd, charsmax(szMotd), "<html>");
iLen = formatex(szMotd[iLen], charsmax(szMotd)-iLen,"<STYLE>body{background:#212121;color:#d1d1d1;font-family:Arial}table{width:100%%;font-size:11px}</STYLE><table cellpadding=1>");
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Name <th width=10%%> Stats <th width=10%%> Percent <th width=10%%>");
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Addicted! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][CONNECT], iAchPoints[CONNECT], 100 * iAchLevel[id][CONNECT] / iAchPoints[CONNECT]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Headsplasher! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][HEADSHOT], iAchPoints[HEADSHOT], 100 * iAchLevel[id][HEADSHOT] / iAchPoints[HEADSHOT]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> HE Killer! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][GRENADE], iAchPoints[GRENADE], 100 * iAchLevel[id][GRENADE] / iAchPoints[GRENADE]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Bunnyhopper! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][JUMP], iAchPoints[JUMP], 100 * iAchLevel[id][JUMP] / iAchPoints[JUMP]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Pro Bunnyhopper! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][JUMP], iAchPoints[JUMPER], 100 * iAchLevel[id][JUMP] / iAchPoints[JUMPER]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Master Bunnyhopper! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][JUMP], iAchPoints[JUMPISH], 100 * iAchLevel[id][JUMP] / iAchPoints[JUMPISH]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Terroist Surviver! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][SURVIVE], iAchPoints[SURVIVE], 100 * iAchLevel[id][SURVIVE] / iAchPoints[SURVIVE]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Knifer! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][KNIFE], iAchPoints[KNIFE], 100 * iAchLevel[id][KNIFE] / iAchPoints[KNIFE]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Semi Knifer! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][SEMI], iAchPoints[SEMI], 100 * iAchLevel[id][SEMI] / iAchPoints[SEMI]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Pro Knifer! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][PRO], iAchPoints[PRO], 100 * iAchLevel[id][PRO] / iAchPoints[PRO]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> AWP Master! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][AWP], iAchPoints[AWP], 100 * iAchLevel[id][AWP] / iAchPoints[AWP]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Deagle Master! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][DEAGLE], iAchPoints[DEAGLE], 100 * iAchLevel[id][DEAGLE] / iAchPoints[DEAGLE]);
iLen += formatex(szMotd[iLen], charsmax(szMotd)-iLen, "<tr bgcolor=#333333><th width=5%%><align=left font color=white> Fiveseven Master! <th width=10%%> %i/%i <th width=10%%> %d <th width=10%%>", iAchLevel[i][FIVE], iAchPoints[FIVE], 100 * iAchLevel[id][FIVE] / iAchPoints[FIVE]);
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "</p>");
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "</body>");
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "</html>");
show_motd(id,szMotd, "Achievement Player Info");
CmdPlayerInfo(id);
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}