y_ini or SQL?
#5

Quote:
Originally Posted by b3nz
Посмотреть сообщение
You can easily do this with the file system. Take a look at this.
Quote:
Originally Posted by Mariciuc223
Посмотреть сообщение
You can make that with both of them ..

There we are :

Код:
stock const MonthDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

stock DateTimeGet(Plus)
{
    getdate(Year, Month, Day);
    gettime(Hour, Minute, Second);

    Day += Plus;

    if(Day >= MonthDays[Month])
    {
	Month++;
	Day -= MonthDays[Month-1];
    }

    if(Month >= 12)
    {
        Year++;
        Month -= 12;
    }
}
Get actual time and add X days ... DateTimeGet(30) will mean 30 days of valability ... you can stock it so ..

Код:
public SetPlayerDriverLicense(playerid)
{
    DateTimeGet(30);

    pLicense[playerid][pDriver] = 1;
    pLicense[playerid][pDriverLY] = Year;
    pLicense[playerid][pDriverLM] = Month;
    pLicense[playerid][pDriverLD] = Day;
    pLicense[playerid][pDriverLH] = Hour;
    pLicense[playerid][pDriverLMIN] = Minute;
    pLicense[playerid][pDriverLS] = Second;

    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File, "Licenses");

    INI_WriteInt(File, "DriverLicense", 1);
    INI_WriteInt(File, "DriverLicense_Year", Year);
    INI_WriteInt(File, "DriverLicense_Month", Month);
    INI_WriteInt(File, "DriverLicense_Day", Day);
    INI_WriteInt(File, "DriverLicense_Hour", Hour);
    INI_WriteInt(File, "DriverLicense_Minute", Minute);
    INI_WriteInt(File, "DriverLicense_Second", Second);
	
    INI_Close(File);
}
Add at the beginning of the script right under #defines

Код:
new Year, Month, Day, Hour, Minute, Second
P.S that exemple it's from my License Script ..

EDIT: When player connect you need to check (Put a timer) if actual date (getdate & gettime) = your array .. In my case

Код:
    pLicense[playerid][pDriverLY] = Year;
    pLicense[playerid][pDriverLM] = Month;
    pLicense[playerid][pDriverLD] = Day;
    pLicense[playerid][pDriverLH] = Hour;
    pLicense[playerid][pDriverLMIN] = Minute;
    pLicense[playerid][pDriverLS] = Second;
to set Vip to value 0 (No vip - or how it's at you) ... if(actual date >= my old date) pLicense[playerid][pDriver] = 0; // ... actual date and my old date dosen't exist it's just so

I hope you understand what i said to you ..
Thanks
Reply


Messages In This Thread
y_ini or SQL? - by TheRaGeLord - 20.07.2015, 11:14
Re: y_ini or SQL? - by b3nz - 20.07.2015, 11:18
Re: y_ini or SQL? - by Glenn332 - 20.07.2015, 11:25
Re: y_ini or SQL? - by Mariciuc223 - 20.07.2015, 12:00
Re: y_ini or SQL? - by TheRaGeLord - 20.07.2015, 12:35
Re: y_ini or SQL? - by Dan. - 20.07.2015, 12:43

Forum Jump:


Users browsing this thread: 1 Guest(s)