SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/01/2020, 12:19 AM   #1
Istrator
Big Clucker
 
Join Date: Dec 2017
Posts: 50
Reputation: 0
Default VIP System Help

I just made my own VIP System but how can I configure this thing where it will detect the expiry of player's VIP.

Code:
function CheckVip(playerid)
{
    new lmonth, lday, lyear;
    
    getdate(lyear, lmonth, lday);
    
    if(pInfo[playerid][pVipLevel] >= 1)
    {
        if(pInfo[playerid][vYear] <= lyear)
        {
            if(pInfo[playerid][vMonth] <= lmonth)
            {
                if(pInfo[playerid][vDay] <= lday)
                {
                       new string[300];
                    pInfo[playerid][pVipLevel] = 0;
                    pInfo[playerid][pVipFlash] = 0;
                    pInfo[playerid][vYear] = 0;
                    pInfo[playerid][vMonth] = 0;
                    pInfo[playerid][vDay] = 0;
                    SCM(playerid, -1, ""COL_RED">> Your VIP has been expired");
                    format(string, sizeof(string), "%s VIP has been expired", PlayerName(playerid));
                    printf(string);
                }
            }
        }
    }
    return 1;
}
I'm using that code. At first, it works perfectly but after I restart the server, it expires the VIP.
Can someone help me to make this thing works?
Istrator is offline   Reply With Quote
Old 08/01/2020, 03:54 AM   #2
grymtn
Huge Clucker
 
Join Date: Jun 2013
Posts: 267
Reputation: 26
Default Re: VIP System Help

umm are you saving your variables anywhere like mysql or dini? if so how are you doing it and is it loading normal when you try to load your data back?
__________________
grymtn is offline   Reply With Quote
Old 08/01/2020, 10:02 AM   #3
Vizi10
Huge Clucker
 
Join Date: May 2017
Location: Iran
Posts: 286
Reputation: 8
Default Re: VIP System Help

Save vars and load after player logged.
or use unixtime.
Vizi10 is offline   Reply With Quote
Old 08/01/2020, 12:03 PM   #4
IzadorO
Huge Clucker
 
IzadorO's Avatar
 
Join Date: Feb 2015
Location: Scotland, Glasgow
Posts: 204
Reputation: 17
Default Re: VIP System Help

Quote:
Originally Posted by Vizi10 View Post
Save vars and load after player logged.
or use unixtime.
Using unixtime is very easy, here is an example:

Code:
pInfo[playerid][pVipExpire] = gettime() + 2629743 // Adding 1 month to unix time in seconds, make sure this is saved, once loaded, simply do this if check

if (pInfo[playerid][pVipLevel] && pInfo[playerid][pVipExpire] <= gettime()) {
    // Their vip has ran out, post whatever you want here.
}
__________________

Last edited by IzadorO; 08/01/2020 at 05:29 PM.
IzadorO is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Job System, House Rent System and Event System AngeloBrand98 Scripting Help 2 08/11/2016 08:34 AM
[FilterScript] NRank System V1.0 | Advanced Rank System | 5+ Commands | Dialog System [Much More] Nirzor Filterscripts 9 18/04/2014 10:49 PM
[FilterScript] Cross Admin System V1.2 [updated] + Added IRC System + Anti Cheat(sscanf, dcmd,y_ini) No.1 Admin System CROSS_Hunter Filterscripts 21 02/01/2013 07:32 PM


All times are GMT. The time now is 03:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.