pawn Код:
stock GetCharsCount(const string[], ...)
{
new Count, num = numargs();
for(new n = 1; n<num; n++) for(new i; i<strlen(string); i++) if(getarg(n, 0) && string[i] == getarg(n, 0)) Count++;
return Count;
}
stock GetNumericCharsCount(const string[]) return GetCharsCount(string, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57);
stock bool:GetNumericPartOfString(const string[], output[], &index)
{
new lenght = strlen(string);
if(!lenght || !GetNumericCharsCount(string)) return false;
while(index < lenght && !IsNumericChar(string[index])) index++;
new offset = index;
while(index < lenght && IsNumericChar(string[index])) output[index - offset] = string[index], index++;
return true;
}
stock GetPlayerID(const name[], bool:ignorecase = false)
{
new output[5], index;
for(new i; i<GetMaxPlayers(); i++) if(IsPlayerConnected(i)) if(strfind(Name(i), name, ignorecase) != -1) return i;
if(IsNumeric(name) && IsPlayerConnected(strval(name))) return strval(name);
if(GetNumericPartOfString(name, output, index)) if(IsPlayerConnected(strval(output))) return strval(output);
return INVALID_PLAYER_ID;
}
I hope, it will help you. HAND.