Admin list is not working properly
#1

So hi everyone I got problem.
If Admin 1 and(or) 2 is off not showing they are off. Always show they are online. What is wrong with this script?
It get's from database Admin names, ID. I set on gamemode init and onplayerconnect Player[playerid][Admin] = 0;
Код:
CMD:Adminlist(playerid,params[])
{
	mysql_function_query(g_SQL,"SELECT `username`,`Admin` FROM `players` WHERE `Admin` > 0;",true,"Admins","d",playerid);
	return 1;
}
forward AdminList(playerid);
public AdminList(playerid)
{
	new info[2048];
	if(cache_get_row_count() > 0)
	{
		for(new row = 0;row<cache_get_row_count();row++)
		{
			new Nickas[24],AdmID,id;
			cache_get_row(row, 0, Nickas);
			AdmID = cache_get_row_int(row, 1);
			printf("%s %i", Nickas, AdmID);
			if(!sscanf(Nickas, "u", id))
			{
				if(IsPlayerConnected(id))
				{
					switch(AdmID)
					{
						case 1:
						{
							new string[144];
							format(string, 144, "{FFFFFF}ON {00FF00}%s\n",Nickas);
							strcat(info, string);
						}
						case 2:
						{
							new string[144];
							format(string, 144, "{FFFFFF}ON {00FF00}%s\n",Nickas);
							strcat(info, string);
						}
					}
				}
				else
				{
					switch(AdmID)
					{
						case 1:
						{
							new string[144];
							format(string, 144, "{FFFFFF}OFF {FF0000}%s\n",Nickas);
							strcat(info, string);
						}
						case 2:
						{
							new string[144];
							format(string, 144, "{FFFFFF}OFF {FF0000}%s\n",Nickas);
							strcat(info, string);
						}
					}
				}
			}
		}
	}
	ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "List", info, "OK", "");
	return 1;
}
Reply


Messages In This Thread
Admin list is not working properly - by Darijus - 20.07.2017, 15:59
Re: Admin list is not working properly - by Darijus - 21.07.2017, 09:06
Re: Admin list is not working properly - by Hansrutger - 21.07.2017, 10:56
Re: Admin list is not working properly - by CodeStyle175 - 21.07.2017, 11:11
Re: Admin list is not working properly - by Darijus - 21.07.2017, 13:27
Re: Admin list is not working properly - by jlalt - 21.07.2017, 14:05
Re: Admin list is not working properly - by Darijus - 21.07.2017, 14:10
Re: Admin list is not working properly - by jlalt - 21.07.2017, 14:13
Re: Admin list is not working properly - by Darijus - 21.07.2017, 14:18

Forum Jump:


Users browsing this thread: 1 Guest(s)