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";
}
}