Why every time I relog my VIP is removed?
#1

What is worng with my VIP system? Everytime I relog say:
"Your VIP expired!"

ADD VIP FUNC
Код:
stock AddVIP(playerid, days, price) {
	if(DP[playerid] < price) {
		new string[50];
		format(string, sizeof(string), "You do not have %i Donate Points", price );
		SendClientMessage(playerid, COLOR_LIGHTRED, string);
	}
	else {
		DP[playerid] -= price;
		VIP[playerid] = 1;
	    if(expirarVIP[playerid] > 0) { expirarVIP[playerid] += (days * 86400); } // already have VIP
	    else { expirarVIP[playerid] = gettime() + (days * 86400); } // dont have VIP
	}
}
Check if end VIP
Код:
			if(gettime() < expirarVIP[playerid]) {
				if(idiom[playerid] == 1) {  SendClientMessage(playerid, COLOR_LIGHTRED, "Sua VIP expirou!"); }
				else if(idiom[playerid] == 2) {  SendClientMessage(playerid, COLOR_LIGHTRED, "Your VIP expired!"); }
				VIP[playerid] = 0;
				expirarVIP[playerid] = 0;
			}
Reply
#2

The gettime() function you use, what does it return? Seconds, milliseconds?
In 1 day, there are 86400000 milliseconds or 86400 seconds. So knowing that, I assume that your custom gettime function returns seconds. How does that function work? Is it based on the Unix Timestamp or on the server uptime or on the IRL time. It should be based on the Unix Timestamp.
Reply
#3

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
The gettime() function you use, what does it return? Seconds, milliseconds?
In 1 day, there are 86400000 milliseconds or 86400 seconds. So knowing that, I assume that your custom gettime function returns seconds. How does that function work? Is it based on the Unix Timestamp or on the server uptime or on the IRL time. It should be based on the Unix Timestamp.
Idk i just take a base here on forum...
Reply
#4

If you're not storing it in permanent storage (i.e. files or database) then of course you're going to lose that data.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
If you're not storing it in permanent storage (i.e. files or database) then of course you're going to lose that data.
Of-course I'm...

I'm save
Код:
    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `DP` = '%d', `VIP` = '%d', `fmembro` = '%d', `preso` = '%d', `presotime` = '%d', `expirarVIP` = '%d', `carid` = '%d', `playerlskin` = '%d', `job` = '%d', `org` = '%d', `carpos0` = '%f', `carpos1` = '%f', `carpos2` = '%f', `carpos3` = '%f', `playerlpos0` = '%f', `playerlpos1` = '%f', `playerlpos2` = '%f', `playerlpos3` = '%f' WHERE Username = '%s'",
    DP[playerid],
    VIP[playerid],
    fmembro[playerid],
    preso[playerid],
    presotime[playerid],
    expirarVIP[playerid],
    carid[playerid],
	playerlskin[playerid],
	job[playerid],
	org[playerid],
    carpos[playerid][0],
    carpos[playerid][1],
    carpos[playerid][2],
    carpos[playerid][3],
    playerlpos[playerid][0],
    playerlpos[playerid][1],
    playerlpos[playerid][2],
    playerlpos[playerid][3],
    GetName(playerid));
    mysql_pquery(ConnectMYSQL, query);
I'm load
Код:
int_dest[15] = cache_get_field_content_int(0, "expirarVIP");     		expirarVIP[playerid] = int_dest[15];
And in mysql is a INT(10)
Код:
21	expirarVIP	int(10)
Reply
#6

And SELECT ?
Reply
#7

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
And SELECT ?
Код:
stock OnPlayerLogin(playerid) {
    new query[512], rows, fields;
	mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", Nome(playerid) );
	mysql_query(ConnectMYSQL,query);
    cache_get_data(rows, fields);
    if(rows) {
		new int_dest[85];
		...
		int_dest[15] = cache_get_field_content_int(0, "expirarVIP");     		expirarVIP[playerid] = int_dest[15];
...
Reply
#8

I really need to fix it, help pls
Reply
#9

uppppppp
Reply
#10

Do you get a message when your VIP is removed? if yes, then find that message and show us the code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)