08.04.2013, 16:24
I've managed to get the code working after your tips, thanks. But how in the hell am I going to put this in ondialogresponse so it'll change THAT person. and not someone else.
pawn Код:
COMMAND:banlist(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 2) {
new banQuery[500], finalString[600], rows;
format(banQuery,sizeof(banQuery),"SELECT * FROM bans WHERE HasExpired ='0'");
mysql_query(banQuery);
mysql_store_result();
rows = mysql_num_rows();
if(!rows)
{
ShowPlayerDialog(playerid, DIALOG_NO_BANS, DIALOG_STYLE_MSGBOX,"{ff6600}No bans","Unfortunatly there weren't any bans in the database","Ok","Cancel");
}
else {
new tmp[MAX_PLAYER_NAME];
for (new i = 0; i < rows; ++i)
{
while(mysql_fetch_row_format(banQuery, "|"))
{
mysql_fetch_field_row(tmp, "BannedPlayer");
strcat(finalString,tmp);
strcat(finalString,"\n");
}
}
strcat(finalString, tmp);
ShowPlayerDialog(playerid,DIALOG_BANLIST,DIALOG_STYLE_LIST, "{ff6600}Banlist", finalString,"Change","Cancel");
}
mysql_free_result();
}
else {
return 0;
}
return 1;
}

