08.03.2010, 20:00
So i have been using this code for(new i=0; i<MAX_PLAYERS; i++) as it should have the cool function it loops through all 200 diffrent IDs.
But i have having this problem that it only calls on playerid 0 which is quiet annoying. Im losing trust to this function. Maybe im doing something wrong but heres a good example where it only loops id 0 for me
Am i using it wrong or do it have some limits?
But i have having this problem that it only calls on playerid 0 which is quiet annoying. Im losing trust to this function. Maybe im doing something wrong but heres a good example where it only loops id 0 for me
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new string[43],name[MAX_PLAYER_NAME];
SendClientMessage(playerid,COLOUR_BLUE,"Current admins online:");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pi[i][Adminlevel] == 1)
{
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"Trial: %s ID: %i",name,i);
SendClientMessage(playerid,COLOUR_WHITE,string);
return 1;
}
if(pi[i][Adminlevel] == 2)
{
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"Mod: %s ID: %i",name,i);
SendClientMessage(playerid,COLOUR_WHITE,string);
return 1;
}
if(pi[i][Adminlevel] == 3)
{
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"Admin: %s ID: %i",name,i);
SendClientMessage(playerid,COLOUR_YELLOW,string);
return 1;
}
if(pi[i][Adminlevel] == 4)
{
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"Lead Admin: %s ID: %i",name,i);
SendClientMessage(playerid,COLOUR_ORANGE,string);
return 1;
}
}
}
return 1;
}