Unix timestamp!
#4

Code:
new VIPTime[MAX_PLAYERS];

public OnPlayerConnect(playerid) {
    VIPTime[playerid] = 0;

    // Load VIPTime from a file.

    if(VIPTime[playerid] != 0) {
        // Give them membership.
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason) {
    // Save the VIPTime variable.
}

public OnPlayerUpdate(playerid) {
    new Timestamp = gettime();

    if(Timestamp >= VIPTime[playerid]) {
        // Cancel their membership.

        VIPTime[playerid] = 0;
    }
    return 1;
}

stock AddMembershipForADay(playerid) {
    if(! IsPlayerConnected(playerid)) {
        return false;
    }

    if(VIPTime[playerid] == 0) { // new member
        VIPTime[playerid] += gettime();

        // Give them membership.
    }

    VIPTime[playerid] += (60 * 60 * 24);
    return true;
}
Something like this, threw it together all in 5minutes.
Reply


Messages In This Thread
Unix timestamp! - by Renaldasj - 18.02.2014, 20:19
Re: Unix timestamp! - by SkittlesAreFalling - 18.02.2014, 20:30
Re: Unix timestamp! - by Renaldasj - 18.02.2014, 20:31
Re: Unix timestamp! - by SkittlesAreFalling - 18.02.2014, 20:41
Re: Unix timestamp! - by Renaldasj - 18.02.2014, 20:45
Re: Unix timestamp! - by SkittlesAreFalling - 18.02.2014, 20:47
Re: Unix timestamp! - by Renaldasj - 18.02.2014, 20:48
Re: Unix timestamp! - by SkittlesAreFalling - 18.02.2014, 21:03
Re: Unix timestamp! - by Renaldasj - 18.02.2014, 21:05
Re: Unix timestamp! - by GamemodeRP123 - 19.02.2014, 03:57

Forum Jump:


Users browsing this thread: 1 Guest(s)