new Player; if(sscanf(params,"u",Player)) return SendClientMessage(playerid,COLOR,"Kick player: [ /kick player ]"); if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR,"Player is not online."); Kick(Player);
Martin_Miller |
/kick mart |
/kick in_Miller |
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;
}
Originally Posted by ¤Adas¤
Try this:
pawn Код:
|
Originally Posted by ¤Adas¤
Why you don't like that
|
Originally Posted by Seif_
Quote:
|
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:IsNumericChar(character) return character > 46 && character < 58;
stock bool:IsNumeric(const string[]) return GetNumericCharsCount(string) == strlen(string);
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) && IsPlayerConnected(strval(output))) return strval(output);
return INVALID_PLAYER_ID;
}