//------------------------------------------------------------------------------------------------------------------------------------
public Action:Command_Frags(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_frags <target> <[+/-]amount>");
return Plugin_Handled;
}
decl String:pattern[MAX_NAME],String:buffer[MAX_NAME],String:frags[MAX_ID];
GetCmdArg(1,pattern,sizeof(pattern));
GetCmdArg(2,frags,sizeof(frags));
new frag = StringToInt(frags);
new targets[MAX_CLIENTS],bool:ml = false;
new count = ProcessTargetString(pattern,client,targets,sizeof(targets),FILTER_REAL,buffer,sizeof(buffer),ml);
if (count <= 0) ReplyToCommand(client,"%t",(count < 0)?"Bad target":"No target",YELLOW,TEAMCOLOR,pattern,YELLOW);
else for (new i = 0; i < count; i++)
{
new t = targets;
new val = GetClientFrags(t);
if ((frags[0] == '+') || (frags[0] == '-'))
{
val += frag;
if (val < 0) val = 0;
if (!ml) Notify(client,t,"Frags Change Notify",val,frags);
if (g_bLog) LogAction(client,t,"\"%L\" changed frags of player \"%L\" to %d [%s]",client,t,val,frags);
} else
{
val = frag;
if (!ml) Notify(client,t,"Frags Set Notify",frags);
if (g_bLog) LogAction(client,t,"\"%L\" changed frags of player \"%L\" to %d",client,t,frag);
}
SetEntProp(t, Prop_Data, "m_iFrags", val);
}
if (ml) Notify2(client,buffer,"Frags Set Notify",frags);
return Plugin_Handled;
}
//------------------------------------------------------------------------------------------------------------------------------------