Hier ein Mini-Gamemode, indem beim Start der aktuelle Unixtimestamp ausgegeben wird:
#include a_samp
stock mktime(hour,minute,second,day,month,year)
{
new timestamp2, days_of_month[12];
timestamp2 = second + (minute * 60) + (hour * 3600);
if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31};
} else {
days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31};
}
new days_this_year = 0;
days_this_year = day;
if(month > 1) {
for(new i=0; i<month-1;i++) {
days_this_year += days_of_month[i];
}
}
timestamp2 += days_this_year * 86400;
for(new j=1970;j<year;j++) {
timestamp2 += 31536000;
if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) timestamp2 += 86400;
}
return timestamp2;
}
public OnGameModeInit()
{
new hour, minute, second, year, month, day, timestamp;
gettime(hour, minute, second);
getdate(year, month, day);
timestamp = mktime(hour,minute,second,day,month,year);
printf("UNIX Timestamp: %d", timestamp);
}