new Seconds = gettime();
printf(\"Seconds since midnight 1st January 1970: %d\", Seconds);
[/quote]
másodperccel tér vissza, tehát elég a 60*60*2 (60másodperc = 1perc, 60perc = 1óra, 2x1óra = 2óra :D)
CMD:test(playerid, params[]) {
if(GetPVarInt(playerid, \"anti_flood\") < gettime()) return SenClientMessage(playerid, -1, \"Még nem használhatod a parancsot\"); // ellenõrzi
SetPVarInt(playerid, \"anti_flood\", gettime() + 60*60*2); // hozzáad 2 órát
// parancs többi része
return 1;
}
ki lehet számolni azt is, hogy mennyi idõ múlva használhatja, de annyira azért nem értek az UNIX idõ számoláshoz.
illetve van ez a jó kis timec függvény (nem tudom ki írta)
stock timec(timestamp, compare = -1) {
if (compare == -1) compare = gettime();
new n,
Float:d = (timestamp > compare) ? timestamp - compare : compare - timestamp,
returnstr[32];
if (d < 60) {
format(returnstr, sizeof(returnstr), \"< 1 minute\");
return returnstr;
} else if (d < 3600) { // 3600 = 1 hour
n = floatround(floatdiv(d, 60.0), floatround_floor);
format(returnstr, sizeof(returnstr), \"minute\");
} else if (d < 86400) { // 86400 = 1 day
n = floatround(floatdiv(d, 3600.0), floatround_floor);
format(returnstr, sizeof(returnstr), \"hour\");
} else if (d < 2592000) { // 2592000 = 1 month
n = floatround(floatdiv(d, 86400.0), floatround_floor);
format(returnstr, sizeof(returnstr), \"day\");
} else if (d < 31536000) { // 31536000 = 1 year
n = floatround(floatdiv(d, 2592000.0), floatround_floor);
format(returnstr, sizeof(returnstr), \"month\");
} else {
n = floatround(floatdiv(d, 31536000.0), floatround_floor);
format(returnstr, sizeof(returnstr), \"year\");
}
if (n == 1) format(returnstr, sizeof(returnstr), \"1 %s\", returnstr);
else format(returnstr, sizeof(returnstr), \"%d %ss\", n, returnstr);
return returnstr;
}
ezzel összehasonlíthatod a 3 idõt, és kiírja, hogy mennyi a 2 között a különbség.. ez csak ilyen látványelem. :)