18.08.2016, 17:31
I've made a VIP system, now I want to make VIP status last 30 days. How do I do that?
new variable = getdate();
public OnPlayerConnect(playerid)
{
if ((getdate() - variable) > 30)
{
// VIP expired
}
}
new day, month, year;
getdate(year, month, day);
new todayyear, todaymonth, todayday;
getdate(todayyear, todaymonth, todayday);
if ((rdn(todayyear, todaymonth, todayday) - rdn(year, month, day)) > 30)
{
// Expired
}
new Hour, Minute, Second, Timestamp;
Timestamp = gettime(Hour, Minute, Second);
Users[playerid][VIPTime] = Timestamp;
new Hour, Minute, Second, Timestamp;
Timestamp = gettime(Hour, Minute, Second);
if (Timestamp - Users[playerid][VIPTime] >= 60 * 60 * 24 * 30) {
// remove VIP, since 30 days have passed
}
new current_time = gettime(); if(Users[playerid][pVIP] != -1) { if(Users[playerid][pVIP] <= current_time) { //expired } else { new days = floatround(((Users[playerid][pVIP] - current_time) / 86400), floatround_floor); new string[55+3]; format(string,sizeof(string),"{FF8900}VIP status is lost after {FFFFFF}%d{FF8900} days",days); SendClientMessage(playerid,-1,string); } }
Users[playerid][pVIP] = (gettime() + (30*86400));