SA-MP Forums Archive
/admins cmd? +REP. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admins cmd? +REP. (/showthread.php?tid=475313)



/admins cmd? +REP. - Lynet - 12.11.2013

Hello guys, currently in-need of /admins command, I'm not sure on how to make this, thats why i'm asking for help here!

Alright, so i'm using SSCANF2, and zCmd, here's my enum:

HTML Code:
enum PlayerInfo
{
   Logged,
   miniadmin,
   Level,
   Duty,
   pGD,
   pTS,
   pVip,
   pCop,
   pAmmo,
   pGuns,
}
And here's my string adminlevels.

HTML Code:
stock aLevel(playerid)
{
  new svString[120];

  switch (PInfo[playerid][Level])
  {
	 case 1: svString = "Trial Admin";
	 case 2: svString = "Junior Admin";
	 case 3: svString = "Low Admin";
	 case 4: svString = "Admin";
	 case 5: svString = "High Admin";
	 case 6: svString = "Experienced Admin";
	 case 7: svString = "Senior Admin";
	 case 8: svString = "Top Admin";
	 case 9: svString = "Lead Admin";
	 case 10: svString = "Head Admin";
	 case 11: svString = "Server Owner";
  }
  return svString;
}



Re: /admins cmd? +REP. - dominik523 - 12.11.2013

maybe something like this:
Code:
CMD:admins(playerid, params[])
{
	new string[128], name[128];
	SendClientMessage(playerid, COLOR_PINK, "List of all online admins:"
	foreach(Player, i)
	{
	    if(pInfo[i][miniadmin])
	    {
			GetPlayerName(i,name,sizeof(name));
	        format(string,sizeof(string), "%s %s",aLevel(i),name);
	        SendClientMessage(playerid,COLOR_WHITE, string);
	    }
	}
	return 1;
}
Also use foreach with zmcd and sscanf


Re: /admins cmd? +REP. - Loot - 12.11.2013

To the author above, you've forgotten a ')' and a semicolon.
pawn Code:
SendClientMessage(playerid, COLOR_PINK, "List of all online admins:");
And why name[128] when max name length is actually 24? (MAX_PLAYER_NAME)
Other than that, the code above should work.


Re: /admins cmd? +REP. - dominik523 - 12.11.2013

well yeah, I didn't see those two symbols, I'm sorry. You can also change name[128] to name[24] as Loot said. I always put strings with 128 characters, that's just my old habit


Re: /admins cmd? +REP. - Lynet - 12.11.2013

I fixed it by myself, but i'm repping you both anyways, thanks.