Ha van olyan függvény a birtokodban, amivel a játékban töltött idejét méred, az alapján megtudod írni. Ha nincs, akkor pedig asszem LAdmin-ban van ilyesmi.
Dupla hozzászólás automatikusan összefûzve. ( 2014. április 12. - 21:27:38 )
stock TimeCucc(time) {
new Time[4],
tstring[128],
total = gettime() - time;
Time[1] = floatround(total / 3600, floatround_floor);
Time[2] = floatround(total / 60, floatround_floor) % 60;
Time[3] = floatround(total % 60, floatround_floor);
Time[0] = Time[1] / 24;
Time[1] -= (Time[0]*24);
format(tstring, sizeof(tstring), \"%d:%02d:%02d:%02d\", Time[0], Time[1], Time[2], Time[3]);
return tstring;
}
nem tudom hogy jó-e.. a time helyére egy gettime() függvény által adott szám kell.. tehát amikor kilép, akkor elmented hogy mittomén
kilépés = gettime()
belépéskor ezt betöltöd, és lefuttatod a függvénnyel..
tesztelni nem tudtam, mert nem igazán akar mûködni a SAMP..
illetve egy függvény, amit hiv. forumon találtam.. a mûködési elvére magadtól kell rájönnöd, de hasonló, mint amit én írtam.
stock timec(timestamp, compare = -1) {
if (compare == -1) {
compare = gettime();
}
new
n,
// on the following line, I have removed the need for the diff() function.
// if you want to use the diff() function in pawn, replace the following with:
// Float:d = diff(timestamp, compare),
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;
}
Ha van olyan függvény a birtokodban, amivel a játékban töltött idejét méred, az alapján megtudod írni. Ha nincs, akkor pedig asszem LAdmin-ban van ilyesmi.
Dupla hozzászólás automatikusan összefûzve. ( 2014. április 12. - 21:27:38 )
stock TimeCucc(time) {
new Time[4],
tstring[128],
total = gettime() - time;
Time[1] = floatround(total / 3600, floatround_floor);
Time[2] = floatround(total / 60, floatround_floor) % 60;
Time[3] = floatround(total % 60, floatround_floor);
Time[0] = Time[1] / 24;
Time[1] -= (Time[0]*24);
format(tstring, sizeof(tstring), \"%d:%02d:%02d:%02d\", Time[0], Time[1], Time[2], Time[3]);
return tstring;
}
nem tudom hogy jó-e.. a time helyére egy gettime() függvény által adott szám kell.. tehát amikor kilép, akkor elmented hogy mittomén
kilépés = gettime()
belépéskor ezt betöltöd, és lefuttatod a függvénnyel..
tesztelni nem tudtam, mert nem igazán akar mûködni a SAMP..
illetve egy függvény, amit hiv. forumon találtam.. a mûködési elvére magadtól kell rájönnöd, de hasonló, mint amit én írtam.
stock timec(timestamp, compare = -1) {
if (compare == -1) {
compare = gettime();
}
new
n,
// on the following line, I have removed the need for the diff() function.
// if you want to use the diff() function in pawn, replace the following with:
// Float:d = diff(timestamp, compare),
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;
}