30.01.2012, 14:12
would this code work to check if a player with a certain id and name is online?
pawn Код:
foreach(Player,i)
{
if(FindPlayerByName(DOMPlayer)!= -1)//if player is online
{
new DOMname[24];
GetPlayerName(i,DOMname,24);
if(strfind(DOMname,"PawnoQ", true) == 0)//if player is the player with the right name
{
SetPlayerScore(i,GetPlayerScore(i)+20);//give only him score
}
}
else
{
//if player is not online
}
}
stock FindPlayerByName(name[])
{
new Pname[24];
foreach(Player,i)
{
GetPlayerName(i, Pname, 24);
if(!strcmp(Pname, name, true)) return i;
}
return -1;
}