PDA

View Full Version : Weird issue


EmilLykke
13/02/2014, 07:32 PM
Hello there..

I am currently having a weird issue with my little command here..

It says: "There are currently '%d' administrators online, type (/ra) for any administrative assistance!"

It says it probably 23812740923748912347234 times. Do you know what the error is? Thankyou for reading.



Here is the command:

COMMAND:admins(playerid, params[])
{
new string[128];
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
new found = GetAdminCount(2);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(found == 0) return SendClientMessage(playerid, 0x8080FF96, "(( There are currently none administrators online. ))");
if(found == 1) return SendClientMessage(playerid, 0x8080ff96, "(( There are currently '1' administrator online, type (/ra) for any administrative assistance! ))");
if(found >= 2)
{
format(string, sizeof(string), "(( There are currently '%d' administrators online, type (/ra) for any administrative assistance! ))", found);
SendClientMessage(playerid, 0x8080FF96, string);
SendClientMessage(playerid, -1, " ");
if(GetPVarInt(i, "Admin") >= 1)
{
if(GetPVarInt(i, "AdminDuty") == 1)
{
format(string, sizeof(string), "(Level: %d) %s (ID: %d) Adminduty: Yes", GetPVarInt(i, "Admin"), RemoveUnderScore(i));
SendClientMessage(playerid, 0x006200FF, string);
}
else if(GetPVarInt(i, "AdminDuty") == 0)
{
format(string, sizeof(string), "(Level: %d) %s (ID: %d) Adminduty: No", GetPVarInt(i, "Admin"), RemoveUnderScore(i));
SendClientMessage(playerid, 0xAE002CFF, string);
}
}
}
}
return 1;
}

jtemple042996
13/02/2014, 10:07 PM
COMMAND:admins(playerid, params[])
{
new string[128];
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
new found = GetAdminCount(2);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(found == 0) return SendClientMessage(playerid, 0x8080FF96, "(( There are currently none administrators online. ))");
if(found == 1) return SendClientMessage(playerid, 0x8080ff96, "(( There are currently '1' administrator online, type (/ra) for any administrative assistance! ))");
if(found >= 2)
{
format(string, sizeof(string), "(( There are currently '%d' administrators online, type (/ra) for any administrative assistance! ))", found);
}
}
SendClientMessage(playerid, 0x8080FF96, string);
SendClientMessage(playerid, -1, " ");
for(new i = 0; i < MAX_PLAYERS; i++){
if(found == 2){
if(GetPVarInt(i, "Admin") >= 1)
{
if(GetPVarInt(i, "AdminDuty") == 1)
{
format(string, sizeof(string), "(Level: %d) %s (ID: %d) Adminduty: Yes", GetPVarInt(i, "Admin"), RemoveUnderScore(i));
SendClientMessage(playerid, 0x006200FF, string);
}
else if(GetPVarInt(i, "AdminDuty") == 0)
{
format(string, sizeof(string), "(Level: %d) %s (ID: %d) Adminduty: No", GetPVarInt(i, "Admin"), RemoveUnderScore(i));
SendClientMessage(playerid, 0xAE002CFF, string);
}
}
}
}
return 1;
}
You had the "There are currently '%d' administrators online, type (/ra) for any administrative assistance!" message inside of your loop, which caused it to send the message to you so many times.