26.03.2016, 16:04
I am using a unix timestamp to save the date of bans. How can I read this for use in my dialog?
forward ShowBanDialog(playerid);
public ShowBanDialog(playerid)
{
new rows, fields, date[6];
cache_get_data(rows, fields);
if(rows)
{
new timestamp[50],BannedBy[32],BanReason[80],string[300];
cache_get_field_content(0, "Timestamp", timestamp, mysql, 50);
cache_get_field_content(0, "BannedBy",BannedBy,mysql,32);
cache_get_field_content(0, "BanReason",BanReason,mysql,80);
TimestampToDate(timestamp,date[0],date[1],date[2],date[3],date[4],date[5],2);
format(string,sizeof(string),"You have been banned by %s\nReason: %s\nAt: %d/%d/%d %d:%d\nIf you think that this is a mistake or deserve an other chance,apply on forums",BannedBy,BanReason,date[2],date[1],date[0],date[3],date[4]);
ShowPlayerDialog(playerid,BannedDialog,DIALOG_STYLE_MSGBOX,"Banned",string,"Close","");
}
return 1;
}
TimestampToDate(timestamp,date[0],date[1],date[2],date[3],date[4],date[5],2);
TimestampToDate(timestamp,date[0],date[1],date[2],date[3],date[4],date[5],2);
TimestampToDate(strval(timestamp),date[0],date[1],date[2],date[3],date[4],date[5],2);
SELECT *, FROM_UNIXTIME(`Timestamp`) AS `date` FROM blablabbla...
cache_get_field_content(0, "date", readable_timestamp, mysql, 50);