Making an Expiry Date for VIP system -
BlackID - 11.08.2012
Hi, how do i make an Expiry Date for VIP system, i'm currently using MySQL system.
Thanks.
Re: Making an Expiry Date for VIP system -
BlackID - 11.08.2012
anyone?
Re: Making an Expiry Date for VIP system -
kickerbat - 11.08.2012
Hi,
This could be done with a PHP script if you could link the .pwn to query something like localhost/expired?uplayer=pName etc.
Re: Making an Expiry Date for VIP system -
kickerbat - 11.08.2012
quick start for you;
Код:
#define URL "www.******.com/expiry.php"
Код:
forward OnCheckResponse(index, response_code, data[]);
Код:
new post_string[MAX_POST_LENGTH];
Код:
public OnPlayerConnect(playerid)
{
CheckExpiry(playerid);
return 1;
}
Код:
stock CheckExpiry(playerid)
{
format(post_string, sizeof(post_string), "expire=%s", playerid);
HTTP(playerid, HTTP_POST, URL, post_string, "OnCheckResponse");
return 1;
}
Код:
public OnCheckResponse(index, response_code, data[])
{
if(response_code == 1)
{
CODE HERE
}
else printf("ERROR");
}
AW: Making an Expiry Date for VIP system -
Tigerkiller - 11.08.2012
You can simply make on with this Function:
pawn Код:
stock mktime(hour,minute,second,day,month,year)
{
new timestamp2;
timestamp2 = second + (minute * 60) + (hour * 3600);
new days_of_month[12];
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
{
days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
}
else
{
days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // keins
}
new days_this_year = 0;
days_this_year = day;
if(month > 1)
{ // No January Calculation, because its always the 0 past months
for(new i=0; i<month-1;i++)
{
days_this_year += days_of_month[i];
}
}
timestamp2 += days_this_year * 86400;
for(new j=1970;j<year;j++)
{
timestamp2 += 31536000;
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag
}
return timestamp2;
}
// Usage:
Veriable[playerid] = gettime+mktime(...);
// The Check could be:
if(gettime() < Veriable[playerid])
{
//VIP isn't expired
}
Re: Making an Expiry Date for VIP system -
BlackID - 11.08.2012
Thanks TigerKiller. But how do i make it MySQL Based?
AW: Re: Making an Expiry Date for VIP system -
Tigerkiller - 11.08.2012
Quote:
Originally Posted by BlackID
Thanks TigerKiller. But how do i make it MySQL Based?
|
You just save and load it like Cash, Score . . .
Info: make a veriable which only holds the timestamp and one for the VIP Status like Bronze, Silber, Gold