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;
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;
Code:
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;
}