using l4d2 Custom Player Stats plugin by muukis, was trying to adopt displaying stats to what I'd prefer. got 2 issues to ask about
1.got problem adding comma separator between digits to player's points number.
stats are shown on infected death this way:
Name (1222) got points for killing infected
PHP Code:
GetClientName(i, Name, sizeof(Name));
CPrintToChat(i, "{blue}%s \x01(%i) got points for killing Infected", Name, (ClientPoints[i] + CurrentPoints[i]));
What I'd want it to look like:
Name (1,222) got poitns for killing infected - with comma after first digit
Powerlord made "port of the AddCommas function to SourceMod.
SourceMod only has a float absolute value function."
PHP Code:
stock AddCommas( iNum, String:szOutput[] , iLen )
{
new String:szTmp[ 15 ] , iOutputPos , iNumPos , iNumLen;
if ( iNum < 0 )
{
szOutput[ iOutputPos++ ] = '-';
iNum = ~iNum + 1; // Two's complement conversion
}
IntToString( iNum, szTmp, sizeof(szTmp));
iNumLen = strlen(szTmp);
if ( iNumLen <= 3 )
{
iOutputPos += StrCat( szOutput , iLen , szTmp );
}
else
{
while ( ( iNumPos < iNumLen ) && ( iOutputPos < iLen ) )
{
szOutput[ iOutputPos++ ] = szTmp[ iNumPos++ ];
if ( ( iNumLen - iNumPos ) && !( (iNumLen = iNumPos ) % 3 ) )
{
szOutput[ iOutputPos++ ] = ',';
}
}
szOutput[ iOutputPos ] = '\0';
}
return iOutputPos;
}
tried to call it:
PHP Code:
new String:szPoints[15];
GetClientName(i, Name, sizeof(Name));
AddCommas((ClientPoints[i] + CurrentPoints[i]), szPoints, sizeof(szPoints));
CPrintToChat(i, "{blue}%s \x01(%s) got points for killing Infected", Name, szPoints);
didn't work. been desperately trying to add this bloody comma for days with no effect, need help
2. another thing about displaying stats - dealing with special infected, for exapmple:
"Name(1,111) got points for (1)Boomer" , VictimName (Boomer) is shown with number in front of it, if there's few of them currently spawned on the map; like when you look at players list thru adminmenu - it says:
1. Hunter
2. (1)Hunter,
when there's couple of infected of the same type. but when you killed (1)Boomer, you can assume there's more nearby, which should be a surprise I suppose. is it possible to remove characters in front of infected name?