[Tutorial] Automatic Expiry VIP Packages
#7

Good tutorial but use timestamps...

Its 1000x easier and faster.

PHP код:
CMD:setvip(playerid,params[]) {
    new 
sPlayer,Time;
    if(
sscanf(params,"ui",sPlayer,Time)) return Msg(playerid,COLOR_RED,"Usage: /setvip [playerid] [days]");
    
    if(
Time <= 0) return Msg(playerid,COLOR_RED,"Time cannot be equal to 0 or go bellow it");
    if(
sPlayer == INVALID_PLAYER_ID) return Msg(playerid,COLOR_RED,"Invalid player");
    
    new 
finalcalc = (Time*3600)+gettime(); /* 3600 seconds per day + currenttime, it will give us until when they have to be VIP*/
    
PlayerInfo[playerid][VIPTime] = finalcalc//store the variable
    
PlayerInfo[playerid][VIPLevel] = 1//optional, set player VIP level or something
    
return true;
}
public 
OnPlayerConnect(playerid) {
    
//load the PlayerInfo[playerid][VIPTime]
    
new currentTime gettime();
    if(
currentTime >= PlayerInfo[playerid][VIPTime]) { //if current time is bigger than the time they should be VIP for.
        
Msg(playerid,COLOR_RED,"Your VIP has expired. Please consider purchasing more");
        
PlayerInfo[playerid][VIPLevel] = 0;
    }
    return 
true;

Reply


Messages In This Thread
Automatic Expiry VIP Packages - by Tamy - 29.12.2015, 20:03
Re: Automatic Expiry VIP Packages - by Leopards - 29.12.2015, 20:08
Re: Automatic Expiry VIP Packages - by Tamy - 30.12.2015, 11:15
Re: Automatic Expiry VIP Packages - by PuN1Sh3r - 30.01.2016, 10:30
Re: Automatic Expiry VIP Packages - by Tamy - 30.01.2016, 11:19
Re: Automatic Expiry VIP Packages - by biker122 - 30.01.2016, 15:16
Re: Automatic Expiry VIP Packages - by TwinkiDaBoss - 30.01.2016, 16:31

Forum Jump:


Users browsing this thread: 1 Guest(s)