Expire VIP/Ban
#1

Well, can someone explain me or show me how actually i must use the unixtime.
Here is my vip cmd.

PHP код:
CMD:setvip(playeridparams[])
{
    new 
levelsIDstr[128];
    if(! (
PlayerInfoplayerid ][ pAdmin ] == 3) ) return 0;
    if( 
sscanf(params,"ui",ID,levels) ) return SendClientMessage(playerid,COLOR_LIGHTBLUE"USAGE: {FFFFFF}/setvip [ID] [Level 1]");
    if( 
levels ) return SendClientMessage(playerid ,COLOR_RED,"ERROR: {FFFFFF}Levels available 1!");
    if( !
IsPlayerConnected(ID) )return SendClientMessage(playerid ,COLOR_RED,"ERROR: {FFFFFF}That user is not connected.");
    if( 
PlayerInfo[ID][pVip] == levels ) return SendClientMessage(playerid ,COLOR_RED"ERROR: {FFFFFF}That person is already this vip level!");
    
GetPlayerNameplayeridpnamesizeof pname );
    
GetPlayerNameIDNamsizeof Nam );
    
format(strsizeofstr ),"{00FFFF}Admin %s has promoted %s to V.I.P.",pname ,Nam);
    
SendAdminMessageCOLOR_LIMEstr );
    
SendClientMessage(IDCOLOR_CYAN"{00FFFF}An admin has set you V.I.P.");
    
PlayerInfo[ID][pVip] = levels;
    return 
1;

Reply
#2

Anyone?
Reply
#3

please be patient.and double posting is aganist the rules of this fourm.And most of the people are slepping right now.so it is best you if look at this thread tomarow.
Reply
#4

I posted this yesterday, i can bump it if it passed 1 day.
Reply
#5

Wrong section tho... Scripting discussion is the right one
Reply
#6

Someone moved the topic here...I posted in Scripting discussion.
Reply
#7

Then make a topic again in Scripting Discussion...this isn't the right place.
Reply
#8

Why should i do that? Why you don't understand? Someone already moved my topic here.

And now on topic.
Can someone tell me how actually can i do that thing using msql.
Reply
#9

Add a field premium_end or similar to your db, int(11). When setting VIP/ban, update that field with the value returned by UNIX_TIMESTAMP(), plus the amount of seconds in which the vip/ban is set to expire. When loading player data, use a query similar to this:

PHP код:
SELECT *, UNIX_TIMESTAMP() > `premium_end` AS `is_vip_expiredFROM `playersWHERE `sqlid` = '%d'
Which will fetch all fields (the star character) and an extra virtual field containing the value 0 or 1 depending on if the vip has expired or not. You can then check that value in your code and send messages, update stuff, etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)