26.10.2015, 15:51
Like this:
PHP код:
static stock CheckMultipleName(const name[])
{
new bool:x,i=GetPlayerPoolSize()+1,n[MAX_PLAYER_NAME];
for(; --i!=-1;)
{
if(!GetPlayerName(i,n,MAX_PLAYER_NAME)) continue;
if(!strcmp(n,name,true))
{
if(x) return 1;
x=true;
}
}
return 0;
}
//Then OnPlayerConnect or somewhere else:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(CheckMultipleName(name))
{
return Kick(playerid); //Here the name was multiple found
}