25.12.2018, 16:43
I already solved this problem, but now I have something similar with the command "/ admins", and in order not to create another topic, I am still here.
The error is that if an administrator is called "Samp", it appears in the list of administrators as "connected", but when the administrator "Samp" leaves the server and another player enters with the name "samp", in the list of " / administrators "connected and disconnected, will mark the administrator" Samp "as if it were connected. By this I mean that if the name of a player looks like an administrator, for example: "Samp" (it's admin) and "samp" (it's a player), and the administrator disconnects and the player connects to the server, the "/ admins" list will continue to mark it as connected because their names are similar.
Any solution? I hope I have explained well.
command:
The error is that if an administrator is called "Samp", it appears in the list of administrators as "connected", but when the administrator "Samp" leaves the server and another player enters with the name "samp", in the list of " / administrators "connected and disconnected, will mark the administrator" Samp "as if it were connected. By this I mean that if the name of a player looks like an administrator, for example: "Samp" (it's admin) and "samp" (it's a player), and the administrator disconnects and the player connects to the server, the "/ admins" list will continue to mark it as connected because their names are similar.
Any solution? I hope I have explained well.
command:
PHP Code:
CMD:admins(playerid, params[])
{
pInfo[playerid][pADMIN_LIST_DIALOG] = 0;
new str[90], string[1800];
format(string, sizeof string, "");
strcat(string, "Name\tRank\tStatus\n");
new DBResult:Result, DB_Query[128], lines;
format(DB_Query, sizeof(DB_Query), "SELECT p_name, p_admin_level FROM players WHERE p_admin_level > '0' ORDER BY p_admin_level * 1 DESC LIMIT 19 OFFSET %d", pInfo[playerid][pADMIN_LIST_DIALOG] * 19);
Result = db_query(basedb, DB_Query);
new player_name[24], connect;
for(new i; i < db_num_rows(Result); i++)
{
db_get_field(Result, 0, player_name, 24);
sscanf(player_name, "u", connect);
format(str, sizeof str, "%s\t%s\t%s\n", player_name, Admin_Name_Rank( db_get_field_int(Result, 1) ), (connect != INVALID_PLAYER_ID ? ("{00FF00}connected"):("{FF0000}disconnected")));
strcat(string, str);
lines ++;
db_next_row(Result);
}
db_free_result(Result);
strcat(string, "Back");
pInfo[playerid][pADMIN_DIALOG_BACK] = lines;
ShowPlayerDialog(playerid, dialogadmins, DIALOG_STYLE_TABLIST_HEADERS, "Admins", string, "next", "close");
return 1;
}