09.09.2018, 17:39
Hey!
How do you make this work?
https://pastebin.com/8iDNMVXb
Im guessing you know what I want to do
How do you make this work?
https://pastebin.com/8iDNMVXb
Im guessing you know what I want to do
CMD:banlist(playerid, params[])
{
//if(pInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use that command.");
new query[32];
mysql_format(Database, query, sizeof query, "SELECT * FROM `banned`");
mysql_pquery(Database, query, "OnServerBanListLookup", "i", playerid);
return 1;
}
forward OnServerBanListLookup(playerid);
public OnServerBanListLookup(playerid)
{
if(!IsPlayerConnected(playerid))
return 1;
if(cache_num_rows())
{
new id,
name[MAX_PLAYER_NAME],
reason[64],
admin,
datestring,
timestring[16],
text[256], // You can increase this in the future.
string[512]; // You can increase this in the future.
SendClientMessage(playerid, -1, "{AFAFAF}----------------------{FF9900}Server Ban List{AFAFAF}----------------------");
for(new i = cache_num_rows(); i > 0; i--)
{
cache_get_value_name_int(i, "ID", id);
cache_get_value_name(i, "Username", name, MAX_PLAYER_NAME);
cache_get_value_name(i, "Reason", reason, 64);
cache_get_value_name(i, "Admin", admin, MAX_PLAYER_NAME);
cache_get_value_name(i, "Date", datestring, 16);
cache_get_value_name(i, "Time", timestring);
format(text, sizeof text, "ID: %d{FF9900}Username: {AFAFAF}%s {FF9900}Reason: {AFAFAF}%s {FF9900}Admin: {AFAFAF}%s Date & Time: {AFAFAF}%s %s\n", id, name, reason, admin, datestring, timestring);
strcat(string, text);
}
ShowPlayerDialog(playerid, 20000, DIALOG_STYLE_MSGBOX, "Server Ban List", string, "Close", "");
// Change dialog ID to a unused dialog ID, or use Dialog_Show if using easyDialog by Emmet.
return 1;
}
else
{
SendClientMessage(extraid, COLOR_GREY, "No bans have been found.");
}
return 1;
}