27.02.2011, 01:23
hi,
im just trying to script an admin function that lists all names of all players currently on the server.
This should be displayed via SendClientMessage.
But how to get all names? How to loop this?
This is what i got so far:
e.g. if there are 3 players online: tom,betty,jack.
In this case it would send 3 ClientMessages to the admin that wrote this command like this.
regards...
im just trying to script an admin function that lists all names of all players currently on the server.
This should be displayed via SendClientMessage.
But how to get all names? How to loop this?
This is what i got so far:
pawn Код:
if (strcmp("/iplist", cmdtext, true) == 0)
{
if(Spieler[playerid][AdminLevel] > 0)//checking if player is admin
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new String[128],name[ 30 ];
GetPlayerName( i, name, 30);
format(String,sizeof(String),"Player %s",name);
SendClientMessage(playerid,0xAA3333AA,String);
}
}
}else return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");
return 1;
}
In this case it would send 3 ClientMessages to the admin that wrote this command like this.
PHP код:
Player tom
Player betty
Player jack