little question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: little question (
/showthread.php?tid=146641)
little question -
Cank - 08.05.2010
is there a way to check if a player is connected withuot the id but with his name, like IsPlayerConnected(name[])?
Re: little question -
Jefff - 08.05.2010
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;
}
Re: little question -
Killa_ - 08.05.2010
Код:
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;
}