VIP System
#10

Quote:
Originally Posted by KamilPolska
Посмотреть сообщение
Will I have to use PlayerInfo[playerid][pVip] for rank and PlayerInfo[playerid][pVipTime] for vip time?

For automatic expiration I do not know how to do it. I checked this link and I do not understand it.
It really depends on your structure in the database. When player is set as vip for 30 days, set it in a new table:
pawn Код:
"INSERT INTO vip (userid, expire_at) VALUES (%d, DATE_ADD(NOW(), INTERVAL 30 DAY))"
or update the main table if this is where you save the vip information:
pawn Код:
"UPDATE users SET vip_expiration = DATE_ADD(NOW(), INTERVAL 30 DAY) WHERE userid=%d"
// vip_expiration default value is 0
The above are examples to understand.

MySQL server can update/remove vips automatically if you set a scheduler as (run this query once):
pawn Код:
CREATE EVENT vip_expire \
ON SCHEDULE EVERY 10 MINUTE \
STARTS NOW() \
DO \
UPDATE users SET vip_expiration=0 WHERE vip_expiration<>0 AND NOW() >= vip_expiration;
or
pawn Код:
CREATE EVENT vip_expire \
ON SCHEDULE EVERY 10 MINUTE \
STARTS NOW() \
DO \
DELETE FROM vip WHERE NOW() >= expire_at;
Again, these are examples. I do not know your tables.

This will run a timer internally in mysql server. If you want to do it from the script, you can retrieve the unix timestamp and assign it in an array as shown earlier. But you better use a timer instead of OnPlayerUpdate.
Reply


Messages In This Thread
VIP System - by KamilPolska - 29.05.2018, 20:30
Re: VIP System - by Calisthenics - 29.05.2018, 21:11
Re: VIP System - by KamilPolska - 30.05.2018, 18:12
Re: VIP System - by KamilPolska - 30.05.2018, 21:24
Re: VIP System - by GTLS - 31.05.2018, 06:26
Re: VIP System - by scripter112 - 31.05.2018, 08:13
Re: VIP System - by UFF - 31.05.2018, 08:54
Re: VIP System - by KamilPolska - 31.05.2018, 11:25
Re: VIP System - by UFF - 31.05.2018, 11:44
Re: VIP System - by Calisthenics - 31.05.2018, 12:52

Forum Jump:


Users browsing this thread: 3 Guest(s)