1
mIRC/pawn Scripting / Re: /c admins bugged
« on: June 06, 2011, 10:13:33 am »
What's wrong here?
[pawn] else if (strcmp(cmd, "admins", true) == 0) {
new Count,i,name[24],string[256];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] >= 2) Count++;
if(!Count) return SendClientMessage(playerid, BLUE,"No admins ingame.");
if(Count == 1)
{
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] >= 2) break;
GetPlayerName(i,name,24);
if(PlayerInfo[playerid][Level] == 5)
{
format(string,256,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 4)
{
format(string,256,"Present Managers: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 3)
{
format(string,256,"Present Administrators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 2)
{
format(string,256,"Present Moderators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
return 1;
}
if(Count >= 1)
{
new owners[128], managers[128], admins[128], mods[128];
new bool:ofirst = false, bool:mfirst = false, bool:afirst = false, bool:mdfirst = false;
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 5)
{
GetPlayerName(i,name,24);
if(!ofirst)
{
format(owners,128,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, owners);
ofirst = true;
}
else format(owners,128,"%s, %s",owners,name);
}
SendClientMessage(playerid, BLUE, string);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 4)
{
GetPlayerName(i,name,24);
if(!mfirst)
{
format(managers,128,"Present Managers: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, managers);
mfirst = true;
}
else format(managers,128,"%s, %s",managers,name);
}
SendClientMessage(playerid, BLUE, managers);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 3)
{
GetPlayerName(i,name,24);
if(!afirst)
{
format(admins,128,"Present Administrators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, admins);
afirst = true;
}
else format(admins,128,"%s, %s",admins,name);
}
SendClientMessage(playerid, BLUE, admins);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 2)
{
GetPlayerName(i,name,24);
if(!mdfirst)
{
format(mods,128,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, mods);
mdfirst = true;
}
else format(mods,128,"%s, %s",mods,name);
}
SendClientMessage(playerid, BLUE, mods);
}
GetPlayerName(playerid, name, 32);
printf("%s has used /admins command");
return 1;
}[/pawn]
[pawn] else if (strcmp(cmd, "admins", true) == 0) {
new Count,i,name[24],string[256];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] >= 2) Count++;
if(!Count) return SendClientMessage(playerid, BLUE,"No admins ingame.");
if(Count == 1)
{
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] >= 2) break;
GetPlayerName(i,name,24);
if(PlayerInfo[playerid][Level] == 5)
{
format(string,256,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 4)
{
format(string,256,"Present Managers: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 3)
{
format(string,256,"Present Administrators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
if(PlayerInfo[playerid][Level] == 2)
{
format(string,256,"Present Moderators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, string);
}
return 1;
}
if(Count >= 1)
{
new owners[128], managers[128], admins[128], mods[128];
new bool:ofirst = false, bool:mfirst = false, bool:afirst = false, bool:mdfirst = false;
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 5)
{
GetPlayerName(i,name,24);
if(!ofirst)
{
format(owners,128,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, owners);
ofirst = true;
}
else format(owners,128,"%s, %s",owners,name);
}
SendClientMessage(playerid, BLUE, string);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 4)
{
GetPlayerName(i,name,24);
if(!mfirst)
{
format(managers,128,"Present Managers: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, managers);
mfirst = true;
}
else format(managers,128,"%s, %s",managers,name);
}
SendClientMessage(playerid, BLUE, managers);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 3)
{
GetPlayerName(i,name,24);
if(!afirst)
{
format(admins,128,"Present Administrators: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, admins);
afirst = true;
}
else format(admins,128,"%s, %s",admins,name);
}
SendClientMessage(playerid, BLUE, admins);
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[Level] == 2)
{
GetPlayerName(i,name,24);
if(!mdfirst)
{
format(mods,128,"Present Owners: %s(%d)",name,i);
SendClientMessage(playerid, BLUE, mods);
mdfirst = true;
}
else format(mods,128,"%s, %s",mods,name);
}
SendClientMessage(playerid, BLUE, mods);
}
GetPlayerName(playerid, name, 32);
printf("%s has used /admins command");
return 1;
}[/pawn]