Jump to content
  • 0

Secoundary VIP System


Flake

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  08/04/15
  • Last Seen:  

Hi everyone, I need help with a VIP script: I'mm using the emulator's VIP system as my "Premium VIP", and I'd like to make a secondary "Basic VIP" obtainable through vote points. The way I did it is by using an item to change the player's group_id and the duration on the login table in the database. My big issue here is to decrease the duration even while the player is offline. I wrote my script based on some other VIP scripts I found and I'm not sure I'm on the right path. Here's the item and script:

item_db.txt:

7711,Update_Ticket,Event Ticket,0,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ query_sql "UPDATE login SET group_id = 6,days = 1  WHERE account_id = "+getcharid(3)+""; },{},{} // TICKET 1 DAY VIP

 

vipclock.txt:

 -    script    VipClock    -1,{

OnClock0000:
    query_sql "UPDATE login SET days = days - '1'";
    end;
}

-    script    OnPCLoginEvent    -1,{
OnPCLoginEvent:
    query_sql "SELECT days FROM login WHERE account_id = '"+ getcharid(3) +"'", @Dias;
    if (@Dias <= 0){
    query_sql "UPDATE login SET group_id = '0' WHERE account_id = '"+ getcharid(3) +"'";
    atcommand "@reloadpcdb";
    dispbottom "[AxonRO Control]";
    dispbottom "Sorry, your VIP days are over, thank you for being a vip AxonRO player.";
    }else{
    dispbottom "[AxonRO VIP Basic]";
    dispbottom "You have "+@Dias+" days of VIP left";
}

}

 

Edited by Flake
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

perhaps you can try save timestamp (total seconds until vip expired) and not days.

on char login, check if the timestamp exceed the stored value, if exceed then cancel the vip

else attach a timer with the remaining seconds and cancel the vip upon timeout.

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Wrong section. Moved to "Scripting Support".

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  08/04/15
  • Last Seen:  

Thats works, thanks.

Problem Solved.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...