13.05.2011, 17:58
(
Last edited by __; 14/05/2011 at 09:23 AM.
)
I've added a list of calculations now, so it should be a bit more clear, but for your predicament, if you had a command with the syntax of '/tempban [playerid] [years] [weeks] [days] [hours]' then you'd have to do something like this:
pawn Code:
CMD:tempban(playerid, params[]) {
new
iYears,
iMonths,
iFinalCalculation = gettime(),
iHours,
iWeeks,
iTarget;
if(sscanf(params, "udddddds", iTarget, iYears, iMonths, iWeeks, iDays, iHours, iMinutes, szReason))
return SendClientMessage(playerid, COLOR, "Syntax: /tempban [playerid] [years] [months] [weeks] [days] [hours] [minutes] [reason]");
iFinalCalculation = gettime() + mktime(iHours, iMinutes, 0, iDays, iMonths, iYears); // get mktime() from here: http://y-less.pastebin.ca/1000201
// iFinalCalculation retains the final unix timestamp you'll set them to be banned for.
// Check when a player connects to see if they have a timestamp, and if they do, check if it exceeds gettime()
// ...if it does, then unban/remove ban
return 1;
}