11.04.2013, 16:37
(
Последний раз редактировалось SomebodyAndMe; 13.04.2013 в 08:43.
)
Hello,
I have a dialog that shows the banned persons details, including BAN ID, username, reason, ip, and expire date.
BUt for some reason the last two don't want to show up correctly

As you can tell by yourself that's a weird looking IP and the expire date is when the UNIX time-stamps started.
The code:
And the part where I fetch the MySQL data:
More information:
Saving it into enums:
When banning someone:
Anyone knows why this is like this?
I have a dialog that shows the banned persons details, including BAN ID, username, reason, ip, and expire date.
BUt for some reason the last two don't want to show up correctly

As you can tell by yourself that's a weird looking IP and the expire date is when the UNIX time-stamps started.
The code:
pawn Код:
case DIALOG_BANLIST:
{
if(response)
{
new banString[800], expireDate[128];
mtime_UnixToDate(expireDate, sizeof(expireDate), BanInfo[listitem][bUNIXExpire]);
format(banString, sizeof(banString), "Ban ID: \t\t%d \nUsername:\t%s \nReason: \t%s \nIP: \t\t%s \nExpires on: \t%s ", BanInfo[listitem][bBanIndex], BanInfo[listitem][bBannedPlayer], BanInfo[listitem][bBanReason], BanInfo[listitem][bBannedIP], expireDate);
ShowPlayerDialog(playerid, DIALOG_BANINFO, DIALOG_STYLE_LIST, "Ban Information", banString, "Ok", "");
}
}
pawn Код:
for (new i = 0; i < rows; ++i)
{
while(mysql_fetch_row_format(banQuery, "|"))
{
mysql_fetch_field_row(BanInfo[i][bBanIndex], "BanIndex");
mysql_fetch_field_row(BanInfo[i][bBannedPlayer], "BannedPlayer");
mysql_fetch_field_row(BanInfo[i][bBannedIP], "BannedIP");
mysql_fetch_field_row(BanInfo[i][bBanIssuer], "BanIssuer");
mysql_fetch_field_row(BanInfo[i][bBanReason], "BanReason");
mysql_fetch_field_row(BanInfo[i][bUNIXExpire], "UNIXExpire");
mysql_fetch_field_row(BanInfo[i][bUNIXBan], "UNIXBan");
strcat(finalString,BanInfo[i][bBannedPlayer]);
strcat(finalString,"\n");
}
}
strcat(finalString, tmp);
ShowPlayerDialog(playerid,DIALOG_BANLIST,DIALOG_STYLE_LIST, "{ff6600}Banlist", finalString,"Change","Cancel");
More information:
Saving it into enums:
pawn Код:
enum E_BAN_INFO
{
bBanIndex,
bBannedPlayer[MAX_PLAYER_NAME],
bBanIssuer[MAX_PLAYER_NAME],
bBanReason[128],
bUNIXExpire,
bUNIXBan,
bBannedIP[30]
};
new BanInfo[MAX_BANS][E_BAN_INFO];
pawn Код:
stock BanPlayer(playerid, playerBanner[], banReason[], banDays)
{
new pName[MAX_PLAYER_NAME], escapedName[MAX_PLAYER_NAME], escapedActionName[MAX_PLAYER_NAME], safeReason[128], playerIp[16], banQuery[300];
GetPlayerName(playerid, pName, sizeof(pName));
mysql_real_escape_string(pName, escapedName);
mysql_real_escape_string(playerBanner, escapedActionName);
mysql_real_escape_string(banReason, safeReason);
GetPlayerIp(playerid, playerIp, sizeof(playerIp));
if(banDays == 0) { format(banQuery, sizeof(banQuery), "INSERT INTO bans(BannedPlayer, BannedIP, BanIssuer, BanReason, UNIXBan, UNIXExpire, ShouldExpire, Expired) VALUES('%s', '%s', '%s', '%s', %i, 0, 0, 0)", escapedName, playerIp, escapedActionName, safeReason, gettime()); }
else { format(banQuery, sizeof(banQuery), "INSERT INTO bans(BannedPlayer, BannedIP, BanIssuer, BanReason, UNIXBan, UNIXExpire, ShouldExpire, Expired) VALUES('%s', '%s', '%s', '%s', %i, %i, 1, 0)", escapedName, playerIp, escapedActionName, safeReason, gettime(), gettime() + (banDays * 86400)); }
mysql_query(banQuery);
KickEx(playerid, 5);
return 1;
}
Anyone knows why this is like this?