Making Auto VIP Removal
#1

Hi, I am trying to make a VIP System which automatically removes the player's VIP Subscription after specific period of time. The command which sets the player a VIP Member will take two parameters, playerid, and vip level. On each level there will be specific month VIP Subscription and player will stop availing once it's past the time period, without any admin physically removing it.

I hope my question explained well enough.
Reply
#2

Quote:
Originally Posted by Tayab
Посмотреть сообщение
Hi, I am trying to make a VIP System which automatically removes the player's VIP Subscription after specific period of time. The command which sets the player a VIP Member will take two parameters, playerid, and vip level. On each level there will be specific month VIP Subscription and player will stop availing once it's past the time period, without any admin physically removing it.

I hope my question explained well enough.
Check whenever the player logins into his VIP Account the current date and check it against whatever day it was supposed to expire? You need to store when the VIP level is supposed to expire.

getdate() returns the amount of days since the start of the current year, store that variable in wherever the player stats are saved.

You can do for example getdate()+30 (current day + 30 days) whenever the player is set to a vip, and then when the player logins, check if the current day is higher or equal than the stored days. That would mean that the expiration date of thirthy days has been reached and then proceed to remove the VIP level.

This would, however, expire all accounts after the 31st of december of every year unless you go into making some maths. In such case you can use timestamps ...
Reply
#3

I kinda got what you said but it'd be better if you explain in a bit different way, maybe an example.

Thanks.
Reply
#4

Quote:
Originally Posted by Tayab
Посмотреть сообщение
I kinda got what you said but it'd be better if you explain in a bit different way, maybe an example.

Thanks.
OnPlayerLogin:
pawn Код:
if(timestamp() >= GetPVarInt(playerid,"VIPExpiration"))
{
    SetPVarInt(playerid, "VIP", 0);
    SendClientMessage(playerid, 0xFF0000FF, "Your VIP time has expired.");
}

Whenever you make the player a VIP LEVEL

pawn Код:
SetPVarInt(playerid,"VIPExpiration", timestamp()+2592000); //2592000 seconds means 30 days
You have to save the variable along with the player stats in it's file/db, and load it before the check at onplayerlogin. You need the timestamp() function too. You can change the amount of seconds to whatever you want

3600 Seconds - 1 Hour
86400 Seconds - 1 Day
604800 Seconds - 1 Week (7 days)
2592000 Seconds - 1 Month (30 days)
31536000 Seconds - 1 Year (365 days)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)