VIP status that last 30 days
#1

I've made a VIP system, now I want to make VIP status last 30 days. How do I do that?
Reply
#2

Save the date when you made him/her VIP:
pawn Код:
new variable = getdate();
// So you have saved this variable and loaded when player connected.

When player connects:
pawn Код:
public OnPlayerConnect(playerid)
{
    if ((getdate() - variable) > 30)
    {
        // VIP expired
    }
}
Reply
#3

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Save the date when you made him/her VIP:
pawn Код:
new variable = getdate();
// So you have saved this variable and loaded when player connected.

When player connects:
pawn Код:
public OnPlayerConnect(playerid)
{
    if ((getdate() - variable) > 30)
    {
        // VIP expired
    }
}
What if I buy Vip at the last day of the year?
Reply
#4

Quote:
Originally Posted by ax1
Посмотреть сообщение
What if I buy Vip at the last day of the year?
It is actually that simple. For more accuracy, you can also use gettime if you want exact date and time lapse.
Reply
#5

What if I buy Vip at the last day of the year?
Reply
#6

Well this is the best way:
Using: http://forum.sa-mp.com/showpost.php?...50&postcount=3

Save date in 3 vars
pawn Код:
new day, month, year;
getdate(year, month, day);
To check:
pawn Код:
new todayyear, todaymonth, todayday;
getdate(todayyear, todaymonth, todayday);

if ((rdn(todayyear, todaymonth, todayday) - rdn(year, month, day)) > 30)
{
    // Expired
}
Its still easy!
Reply
#7

Use the timestamp returned from gettime() (as Gammix mentioned), which will work if they get VIP 1 day before a new year:

For when someone becomes VIP, store the timestamp in your database:
pawn Код:
new Hour, Minute, Second, Timestamp;
Timestamp = gettime(Hour, Minute, Second);

Users[playerid][VIPTime] = Timestamp;
And when they log in:
pawn Код:
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
}
Reply
#8

My version:
check:
Код:
    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);
        }
    }
buy:
Код:
Users[playerid][pVIP] = (gettime() + (30*86400));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)