allow targeting in sm_rank

This commit is contained in:
shavitush 2016-07-08 18:38:23 +03:00
parent cf4d528c72
commit fedde68ac3

View File

@ -98,6 +98,9 @@ public void OnPluginStart()
// admin commands
RegAdminCmd("sm_setpoints", Command_SetPoints, ADMFLAG_ROOT, "Set points for a defined ideal time. sm_setpoints <time in seconds> <points>");
// translations
LoadTranslations("common.phrases");
#if defined DEBUG
// debug
RegServerCmd("sm_calc", Command_Calc);
@ -251,14 +254,29 @@ public Action Command_Rank(int client, int args)
return Plugin_Handled;
}
if(gI_PlayerRank[client] <= 0 || gF_PlayerPoints[client] <= 0.0)
int target = client;
if(args > 0)
{
Shavit_PrintToChat(client, "You are unranked.");
char[] sTarget = new char[MAX_TARGET_LENGTH];
GetCmdArgString(sTarget, MAX_TARGET_LENGTH);
target = FindTarget(client, sTarget, true, false);
if(target == -1)
{
return Plugin_Handled;
}
}
if(gI_PlayerRank[target] <= 0 || gF_PlayerPoints[target] <= 0.0)
{
Shavit_PrintToChat(client, "\x03%N\x01 is unranked.", target);
return Plugin_Handled;
}
Shavit_PrintToChat(client, "You are ranked \x03%d\x01 with \x05%.02f points\x01.", gI_PlayerRank[client], gF_PlayerPoints[client]);
Shavit_PrintToChat(client, "\x03%N\x01 is ranked \x03#%d\x01 with \x05%.02f points\x01.", target, gI_PlayerRank[target], gF_PlayerPoints[target]);
return Plugin_Handled;
}