little question
#1

is there a way to check if a player is connected withuot the id but with his name, like IsPlayerConnected(name[])?
Reply
#2

Something like this
Код:
stock IsNickConnected(Nick[])
{
	new Name[24];
	for(new d,g=GetMaxPlayers(); d < g; d++)
		if(IsPlayerConnected(d) && !IsPlayerNPC(d))
		{
			GetPlayerName(d,Name,24);
			if(!strcmp(Name,Nick,true)) return true;
		}
	return false;
}
Reply
#3

Код:
IsPlayerNickConnected(Name[])
{
  PlayerNick[MAX_PLAYER_NAME];
  for(new i=0; i <= GetMaxPlayers(); i++)
  {
    if(IsPlayerConnected(i) && !IsPlayerNPC(i))
    {
      GetPlayerName(i, PlayerNick, MAX_PLAYER_NAME);
      if(strfind(PlayerNick,Name,true) != -1) return 1;
    }
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)