VIP Expiration Date
#1

The following is called when the player logins in via a registration system:

pawn Код:
if(strlen(Player[playerid][VipExpirationDate]) == Day && Player[playerid][VipExpirationMonth] == Month && Player[playerid][VipLevel] >= 1)
            {
                    format(string, sizeof(string), "Your VIP subscription (level %d) has expired.", Player[playerid][VipLevel]);
                    SendClientMessage(playerid, YELLOW, string);
                    Player[playerid][VipLevel] = 0;
                    Player[playerid][VipExpirationDate] = 0;
                    Player[playerid][VipExpirationMonth] = 0;
                   
                    format(string, sizeof(string), "%s's VIP subscription (level %d) has expired.", GetNameWithUnderscore(playerid), Player[playerid][VipLevel]);
                    SendToAdmins(ADMINORANGE, string, 0);
            }
However, it is not working. I view my player file, and it says that my VIP will expire (Day) 7 (Month) 9. And via the command /vipexpdate, it says my VIP will expire on 9/7.

So I'm not sure whats wrong, if Day = VipExpirationDate and Month = VipExpirationMonth then take the VIP away, haha. But, even when I do a debug test, which is printing something when the player logs on. It didn't print anything to the console.

Yes my VIP level is above or equal to one.

REP+
Reply
#2

Why not use a unix timestamp?
Reply
#3

You can use Unix Timestamps which are a much shorter efficient method to handling dates. I wrote a tutorial here.
Reply
#4

._.
this thing is the problem - "strlen(Player[playerid][VipExpirationDate]) == Day"
u dont use strlen here...
use this "Player[playerid][VipExpirationDate] == Day"

Edit; there is a back draw of the code you are using..
If u login on the day vip would be expired then ur vip will be taken..
But what if u dont login on the day of expiration date and login a day after that? then the vip will not be taken...
So solution to this is use the following if Line
pawn Код:
if(Player[playerid][VipExpirationDate]) >= Day && Player[playerid][VipExpirationMonth] >= Month && Player[playerid][VipLevel] >= 1)
here u use >= instead of of == to avoid the bug
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
._.
this thing is the problem - "strlen(Player[playerid][VipExpirationDate]) == Day"
u dont use strlen here...
use this "Player[playerid][VipExpirationDate] == Day"

Edit; there is a back draw of the code you are using..
If u login on the day vip would be expired then ur vip will be taken..
But what if u dont login on the day of expiration date and login a day after that? then the vip will not be taken...
So solution to this is use the following if Line
pawn Код:
if(Player[playerid][VipExpirationDate]) >= Day && Player[playerid][VipExpirationMonth] >= Month && Player[playerid][VipLevel] >= 1)
here u use >= instead of of == to avoid the bug
yuss sir plz give me ur experticeee
pawn Код:
C:\Users\Jason\Documents\Something Gaming\Something Roleplay\gamemodes\RP.pwn(3658) : error 029: invalid expression, assumed zero
C:\Users\Jason\Documents\Something Gaming\Something Roleplay\gamemodes\RP.pwn(3658) : warning 215: expression has no effect
C:\Users\Jason\Documents\Something Gaming\Something Roleplay\gamemodes\RP.pwn(3658) : error 001: expected token: ";", but found ")"
C:\Users\Jason\Documents\Something Gaming\Something Roleplay\gamemodes\RP.pwn(3658) : error 029: invalid expression, assumed zero
C:\Users\Jason\Documents\Something Gaming\Something Roleplay\gamemodes\RP.pwn(3658) : fatal error 107: too many error messages on one line
Quote:
Originally Posted by Calgon
Посмотреть сообщение
You can use Unix Timestamps which are a much shorter efficient method to handling dates. I wrote a tutorial here.
Will do, thank you.
Reply
#6

pawn Код:
if(Player[playerid][VipExpirationDate] >= Day && Player[playerid][VipExpirationMonth] >= Month && Player[playerid][VipLevel] >= 1)
forgot to remove a round bracket
Use the above one
But this code will bug if player logs in next month of expiration date
The full proof bug free way is to use Unix Timestamps
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)