Originally Posted by DTV
If the name still shows up after they've logged out, I'm guessing it's because you don't clear player variables when a player logs out or logs in, otherwise it wouldn't show up. Not to mention, you're using an unnecessary loop to check their admin level, you can simply check if their admin level isn't 0, also you're just looping through MAX_PLAYERS and not checking to see if the player's online or not.
pawn Код:
CMD:admins(playerid, params[]) { if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5); if(pInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command."); new str[128], count=0; for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) //better loop as it doesn't go through every player slot, just the max playerid on the server { if(!IsPlayerConnected(i)) { continue; } //skips any playerids that aren't onine if(pInfo[i][Admin] != 0) { format(str, 256, "{66ff99}%s (level: %d)", PlayerName[i], pInfo[i][Admin]); //str is not 256 long as you declared it to be 128, either change this line or increase the str to 256 SendClientMessage(playerid, -1, str); count ++; } } format(str, sizeof(str), "{66ff99}There are currently %d admins online.", count); SendClientMessage(playerid, -1, str); return 1; }
|