24.11.2014, 08:06
I need help on getting the date when the player will lost his VIP.
For example, Today is November 24, and i set someone's VIP for 2 days, It should display something like this
"You are now VIP, Your VIP will expire in November 26".
I am using Unix Timestamp to do these expiration stuffs, and SQLite to save the timestamp.
I've used Vince's advice on someone's topic about the temporary VIP system, Do you think it would work?
And is it even possible to get the date of the expiration?
For example, Today is November 24, and i set someone's VIP for 2 days, It should display something like this
"You are now VIP, Your VIP will expire in November 26".
I am using Unix Timestamp to do these expiration stuffs, and SQLite to save the timestamp.
I've used Vince's advice on someone's topic about the temporary VIP system, Do you think it would work?
And is it even possible to get the date of the expiration?
pawn Code:
CMD:setvip(playerid, params[])
{
new
string[200],
id,
level,
days
;
LoginCheck(playerid);
if(User[playerid][accountAdmin] >= 3)
{
if(sscanf(params, "uii", id, level, days)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [playerid] [level(0/1)] [days]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "» "red"Player not connected.");
if(level < 0 || level > 1) return SendClientMessage(playerid, -1, "» "red"Levels shouldn't go below zero and shouldn't go above one.");
if(level == User[id][accountVIP]) return SendClientMessage(playerid, -1, "» "red"Player is already in that VIP level.");
if(User[id][accountLogged] == false) return SendClientMessage(playerid, -1, "» "red"Player not logged in.");
if(level != 0)
{
if(days < 2 || days > 363) return SendClientMessage(playerid, -1, "» "red"Expiration shouldn't go below two and shouldn't go abovee three hundred three.");
return 1;
}
if(level == 1)
{
User[id][ExpirationVIP] = gettime() + 60*60*24*days;
format(string, 128, "» "newb"You have been invited to the VIP Team by %s.", GetName(playerid));
SendClientMessage(id, -1, string);
format(string, 128, "» "newb"You have invited %s to VIP Team rank.", GetName(id));
SendClientMessage(playerid, -1, string);
format(string, 128, "%s has been invited to the VIP Team by %s.", GetName(id), GetName(playerid));
Log("premium.txt", string);
}
else if(level == 0)
{
days = 0;
format(string, 128, "» "newb"You have been kicked out from the VIP Team by %s.", GetName(playerid));
SendClientMessage(id, -1, string);
format(string, 128, "» "newb"You have kicked out %s from the VIP team.", GetName(id));
SendClientMessage(playerid, -1, string);
format(string, 128, "%s has been kicked out from the VIP Team by %s.", GetName(id), GetName(playerid));
Log("premium.txt", string);
}
User[id][accountVIP] = level;
SaveData(id);
}
else
{
SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command.");
}
return 1;
}