Jump to content
  • 0

NPC Script for this VIP System


Angry Mjoo

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

Can someone help me in making an NPC Script for this..

Instead of whispering this NPC, I'll just talk to that NPC and give any requirements if it has..

Original Script Method: Whispering

Customized Method: Talkable NPC, and has Requirements to be a VIP Member..

Original Topic: is on eAthena.

here's the code..

- script vip -1,{
//*********************************************************************
// VIP System for eAthena servers Version 3.0
//*********************************************************************
// It allows you to boost experience and drop rate for players who donate
// for a specified amount of days.
// It makes use of account's GM Levels to specify the account type,
// by default values are these:
//  - Account Level 0 = Non VIP Account
//  - Account Level 1 = VIP Silver Account
//  - Account Level 2 = VIP Gold Account
//  - Account Level 3 = VIP Platinum Account
// all of them, of course, customizable .
// ¡Therefore, you can also set =atcommands= for every account level in
// [yourserver]/conf/atcommand_athena.conf ! Isn't that great?! 
// In other words, VIP players can have access to more @commands than
// normal users if you want. This will add more value to the service.
//
// Add, List, Modify and Remove VIP accounts via whisper to this NPC.
// Manage VIP accounts in-game! Just whisper any text to the npc "vip"
// to access the VIP management menu.
//
// This script requires some database modifications for it to work,
// check them at the original post where I posted this script.
// URI:
//
// Created by: Victor H. Olvera (VicThor)
// If you like this, please donate to paypal: [email protected]
// I'd really like to make more scripts like this, so help if you can!
//
// If you want any special modification or adaptation of this script,
// please! feel free to e-mail me at [email protected] I'm $ure I can
// provide you with something according to your need$ 
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//**************** VIP SYSTEM CONFIGURATION *************************
set $VIPs_SilverAccLevel,1;  // Account Level assigned for VIP Silver  *
set $VIPs_GoldAccLevel,2;  // Account Level assigned for VIP Gold   *
set $VIPs_PlatinumAccLevel,3; // Account Level assigned for VIP Platinum *
set $VIPs_SilverExpRate,50;  // VIP Silver Exp Boost in % ( 1 = 1% )  *
set $VIPs_GoldExpRate,100;  // VIP Gold Exp Boost in % ( 1 = 1% )   *
set $VIPs_PlatinumExpRate,150; // VIP Platinum Exp Boost in % ( 1 = 1% )  *
set $VIPs_SilverItemRate,10;  // VIP Silver Item Drop Boost in % ( 1 = 1% ) *
set $VIPs_GoldItemRate,20;  // VIP Gold Item Drop Boost in % ( 1 = 1% ) *
set $VIPs_PlatinumItemRate,30; // VIP Platinum Item Drop Boost in % ( 1 = 1%)*
set $VIPs_AdminGmLevel,99;  // Define GM Level enabled to add, list and *
   // remove VIP entries. Any GM with access le- *
   // vel equal or higher than this will be able *
   // to manage VIP Accounts.	  *
// ********************************************************************
//
// Actions and checks when player logs in about his/her account type status.
OnPCLoginEvent:
// Obtain account data
set .@getAccountType$,query_sql("SELECT `account_type` FROM login WHERE `account_id` = "+getcharid(3)+";",.@accountType$);

// First of all deACTIVEte all VIP benefits
sc_end sc_expboost;
sc_end sc_itemboost;

// If account type is PLATINUM
if (.@accountType$ == "PLATINUM")
{
 set .@getVipStatus,query_sql("SELECT `status` FROM `vip_platinum` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Get account type status
 set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_platinum WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$); // Get expiration date
 if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // If current date is higher than expiration date...
 {
  // terminateVip function on line 430, removes player VIP entry from database table "vip_platinum"
  callsub terminateVip,"vip_platinum",getcharid(3); goto L_displayInfo;
 }
 // If expiration date has not arrived yet, ACTIVEte VIP benefits.
 else
 {
  sc_start sc_expboost,1000*60*60*24,$VIPs_PlatinumExpRate;
  sc_start sc_itemboost,1000*60*60*24,$VIPs_PlatinumItemRate;
  goto L_displayInfo;
 }
}

if (.@accountType$ == "GOLD")
{
 set .@getVipStatus,query_sql("SELECT `status` FROM `vip_gold` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
 set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_gold WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$); // Obtener Fecha de expiración
 if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiración...
 {
  // terminateVip function on line 430, removes player VIP entry from database table "vip_gold"
  callsub terminateVip,"vip_gold",getcharid(3); goto L_displayInfo;
 }
 // If expiration date has not arrived yet, ACTIVEte VIP benefits.
 else
 {
  sc_start sc_expboost,1000*60*60*24,$VIPs_GoldExpRate;
  sc_start sc_itemboost,1000*60*60*24,$VIPs_GoldItemRate; goto L_displayInfo;
 }
}

if (.@accountType$ == "SILVER")
{
 set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
 set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$); // Obtener Fecha de expiración
 if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiración...
 {
  // terminateVip function on line 430, removes player VIP entry from database table "vip_silver"
  callsub terminateVip,"vip_silver",getcharid(3); goto L_displayInfo;
 }
 // If expiration date has not arrived yet, ACTIVEte VIP benefits.
 else
 {
  sc_start sc_expboost,1000*60*60*24,$VIPs_SilverExpRate;
  sc_start sc_itemboost,1000*60*60*24,$VIPs_SilverItemRate; goto L_displayInfo;
 }
}

// If account type is normal, just display account type information.
if (.@accountType$ == "NORMAL")
{
 set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
 set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %M %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$); // Obtener Fecha de expiración
 goto L_displayInfo;
}
// Displays account type status on login on chat window.
L_displayInfo:
dispbottom "----------------------------------------------------------------------";
dispbottom "Account type:		 "+.@accountType$;
dispbottom "Status:					 "+.@vipStatus$;
dispbottom "Expiration date: "+.@expirationDate$;
dispbottom "----------------------------------------------------------------------";
end;
OnWhisperGlobal:
if ( getgmlevel() < $VIPs_AdminGmLevel ) end;

On_gm:
set .@npcName$,"[VIP System v3.0]";

mes .@npcName$;
mes "Welcome, "+strcharinfo(0)+"!";
mes "¿What can I do for you today?";
next;
switch(select("VIP Silver Menu:VIP Gold Menu:VIP Platinum Menu:Quit"))
{
 case 1: // VIP Silver
  next;
  mes .@npcName$;
  mes "[VIP SILVER]";
  switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
  {
case 1: // Add/Extend
 mes "Type the Account Name";
 mes "you wish to add.";
 input .@accountName$;
 next;
 mes .@npcName$;
 mes "[VIP SILVER]";
 mes "Type the number of days you";
 mes "wish to add to the account's VIP";
 mes "status.";
 next;
 mes .@npcName$;
 mes "[VIP SILVER]";
 input .@silverDays;
 // Fetch account's ID using the name of the account previously typed.
 set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
 mes "Identifying account: "+.@accountName$+".";
 sleep2 rand(100,2000); // Looks like it's working on something 
 if (!.@accountId) // Let's verify if the entered account exists or GM is just high...
 {
  mes "ERROR: Couldn't find account.";
  mes "Verify if you dind't make a typo.";
  close;
 }
 else
 {  // Now lets check if the account is already 'vip_silver'
  set .@getSilverAccount,query_sql("SELECT `account_id` FROM vip_silver WHERE `account_id` = "+.@accountId+";",.@silverAccountId);
  if (.@silverAccountId == .@accountId) // If the account is already VIP we will update instead of inserting a new entry.
  {
   mes "Account ID: "+.@silverAccountId+".";
   sleep2 rand(100,850);
   query_sql("UPDATE vip_silver SET end_date = DATE_ADD(end_date, INTERVAL "+.@silverDays+" DAY) WHERE account_id = "+.@silverAccountId+";");
   query_sql("UPDATE vip_silver SET `status` = 'ACTIVE' WHERE account_id = "+.@silverAccountId+";");
   query_sql("UPDATE login SET `account_type` = 'SILVER' WHERE account_id = "+.@silverAccountId+";");
   mes "Account "+.@silverAccountId+" updated";
   mes "successfuly!";
   close;
  }
  else // If the account is not already a VIP Silver one, add a new entry.
  {
   mes "Account ID: "+.@accountId+".";
   sleep2 rand(100,850);
   query_sql("INSERT INTO vip_silver (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
   sleep2 100;
   query_sql("UPDATE vip_silver SET end_date = DATE_ADD(start_date, INTERVAL "+.@silverDays+" DAY) WHERE account_id = "+.@accountId+";");
   query_sql("UPDATE `login` SET `level` = 1 WHERE `account_id` = "+.@accountId+";");
   query_sql("UPDATE login SET `account_type` = 'SILVER' WHERE account_id = "+.@accountId+";");
   mes "Account "+.@accountId+" added";
   mes "successfuly!";
   close;
  }
 }
 close;
case 2: // Delete
 set .@getSilverList_1$,query_sql("SELECT account_name FROM vip_silver LIMIT 0,127;", .@silverList_1$); // query_sql can only display the first 128 lines of a table. This is so sad 
 if ( getarraysize(.@silverList_1$) == 0 )
 {
  mes "There are currently no VIP";
  mes "Silver accounts.";
  close;
 }
 else
 {
  mes "Select the account you wish ";
  mes "to remove from VIP system.";

  set .@j$, "1. "+ .@silverList_1$;
  for (set .@i,1; .@i < getarraysize(.@silverList_1$); set .@i, .@i + 1 )
   set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@silverList_1$[.@i];
  set .@j$, .@j$ +":Cancel";
  next;
  mes .@npcName$;
  mes "[VIP SILVER]";
  set .@menu, select(.@j$) -1;
  if ( .@menu == getarraysize(.@silverList_1$) ) { next; goto On_gm; }
  mes "Are you sure you want to remove the account ";
  mes .@silverList_1$[.@menu] +" ?";
  if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
  query_sql ("UPDATE `login` SET `level` = 0 WHERE `userid` = '"+.@silverList_1$[.@menu]+"';");
  query_sql ("DELETE FROM vip_silver WHERE account_name = '"+.@silverList_1$[.@menu]+"';");
  query_sql("ALTER TABLE vip_silver AUTO_INCREMENT = 1;");
  query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@silverList_1$[.@menu]+"';");
  mes "VIP Silver account successfuly deleted!.";
  close;
 }	
 close;

case 3: // List
 mes "VIP Silver accounts list:";
 // List up to 127 vip accounts
 set .@getSilverList_1$,query_sql("SELECT account_name FROM vip_silver LIMIT 0, 127;", .@silverList_1$);
 for (set .@i,0; .@i < getarraysize(.@silverList_1$); set .@i, .@i + 1)
  mes (.@i+1)+". "+.@silverList_1$[.@i]; // You may want to add a next; command and a new LIMIT 128,255 sentence, in case you need to store and display more than 128 VIP accounts.
 close;
case 4: // Back
 goto On_gm;
  }

 case 2: // Gold Menu
  next;
  mes .@npcName$;
  mes "[VIP GOLD]";
  switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
  {
case 1: // Add
 mes "Type the Account Name";
 mes "you wish to add.";
 input .@accountName$;
 next;
 mes .@npcName$;
 mes "[VIP GOLD]";
 mes "Enter the amount of days you";
 mes "want to add to this account";
 mes "status.";
 next;
 mes .@npcName$;
 mes "[VIP GOLD]";
 input .@goldDays;
 // Fetch account's ID using the name of the account previously typed.
 set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
 mes "Identificando Cuenta: "+.@accountName$+".";
 sleep2 rand(100,2000);
 if (!.@accountId) // Checks if account exists.
 {
  mes "ERROR: Couldn't find account.";
  mes "Verify the account you typed";
  close;
 }
 else
 {  // Verify if account is already 'vip_gold'
  set .@getGoldAccount,query_sql("SELECT `account_id` FROM vip_gold WHERE `account_id` = "+.@accountId+";",.@goldAccountId);
  if (.@goldAccountId == .@accountId) // If it exists, update, not insert
  {
   mes "Account ID: "+.@accountId+".";
   sleep2 rand(100,850);
   query_sql("UPDATE vip_gold SET end_date = DATE_ADD(end_date, INTERVAL "+.@goldDays+" DAY) WHERE account_id = "+.@goldAccountId+";");
   query_sql("UPDATE vip_gold SET `status` = 'ACTIVE' WHERE account_id = "+.@goldAccountId+";");
   query_sql("UPDATE login SET `account_type` = 'GOLD' WHERE account_id = "+.@goldAccountId+";");
   mes "Account "+.@goldAccountId+" updated";
   mes "successfuly!";
   close;
  }
  else // If this account is not already 'vip_gold', add an entry.
  {
   mes "Account ID: "+.@accountId+".";
   sleep2 rand(100,850);
   query_sql("INSERT INTO vip_gold (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
   sleep2 100;
   query_sql("UPDATE vip_gold SET end_date = DATE_ADD(start_date, INTERVAL "+.@goldDays+" DAY) WHERE account_id = "+.@accountId+";");
   query_sql("UPDATE `login` SET `level` = 1 WHERE `account_id` = "+.@accountId+";");
   query_sql("UPDATE login SET `account_type` = 'GOLD' WHERE account_id = "+.@accountId+";");
   mes "Account "+.@accountId+" updated";
   mes "successfuly!";
   close;
  }
 }
 close;
case 2: // Delete
 set .@getGoldList_1$,query_sql("SELECT account_name FROM vip_gold LIMIT 0,127;", .@goldList_1$);
 if ( getarraysize(.@goldList_1$) == 0 )
 {
  mes "There are currently no VIP";
  mes "accounts.";
  close;
 }
 else
 {
  mes "Select the account you wish ";
  mes "to remove from VIP system Gold.";

  set .@j$, "1. "+ .@goldList_1$;
  for (set .@i,1; .@i < getarraysize(.@goldList_1$); set .@i, .@i + 1 )
   set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@goldList_1$[.@i];
  set .@j$, .@j$ +":Cancel";
  next;
  mes .@npcName$;
  mes "[VIP GOLD]";
  set .@menu, select(.@j$) -1;
  if ( .@menu == getarraysize(.@goldList_1$) ) { next; goto On_gm; }
  mes "Are you sure you want to remove the account ";
  mes .@goldList_1$[.@menu] +" ?";
  if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
  query_sql ("UPDATE `login` SET `level` = 0 WHERE `userid` = '"+.@goldList_1$[.@menu]+"';");
  query_sql ("DELETE FROM vip_gold WHERE account_name = '"+.@goldList_1$[.@menu]+"';");
  query_sql("ALTER TABLE vip_gold AUTO_INCREMENT = 1;");
  query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@goldList_1$[.@menu]+"';");

  mes "VIP Gold account successfuly deleted!.";
  close;
 }	
 close;

case 3: // List
 mes "List Accounts VIP Gold:";
 // List only 128 accounts due to eAthena's limitations  very sad indeed.
 set .@getgoldList_1$,query_sql("SELECT account_name FROM vip_gold LIMIT 0,127;", .@goldList_1$);
 for (set .@i,0; .@i < getarraysize(.@goldList_1$); set .@i, .@i + 1)
  mes (.@i+1)+". "+.@goldList_1$[.@i];
 close;
case 4: // Back
 goto On_gm;
  }
 case 3: // Menu VIP Platinum
  next;
  mes .@npcName$;
  mes "[VIP PLATINUM]";
  switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
  {
case 1: // Add
 mes "Type the Account Name";
 mes "you wish to add.";
 input .@accountName$;
 next;
 mes .@npcName$;
 mes "[VIP PLATINUM]";
 mes "Enter the amount of days you";
 mes "will add to this account's";
 mes "status.";
 next;
 mes .@npcName$;
 mes "[VIP PLATINUM]";
 input .@platinumDays;
 // Fetch account's ID using the name of the account previously typed.
 set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
 mes "Identificando Cuenta: "+.@accountName$+".";
 sleep2 rand(100,2000);
 if (!.@accountId) // Checks if account exists
 {
  mes "ERROR: Couldn't find this account";
  mes "Enter the account correctly";
  close;
 }
 else
 {  // Is this account a 'vip_platinum' already?
  set .@getPlatinumAccount,query_sql("SELECT `account_id` FROM vip_platinum WHERE `account_id` = "+.@accountId+";",.@platinumAccountId);
  if (.@platinumAccountId == .@accountId) // If this account is 'vip_platinum' update instead of insterting a new entry.
  {
   mes "Account ID: "+.@accountId+".";
   sleep2 rand(100,850);
   query_sql("UPDATE vip_platinum SET end_date = DATE_ADD(end_date, INTERVAL "+.@platinumDays+" DAY) WHERE account_id = "+.@platinumAccountId+";");
   query_sql("UPDATE vip_platinum SET `status` = 'ACTIVE' WHERE account_id = "+.@platinumAccountId+";");
   query_sql("UPDATE login SET `account_type` = 'PLATINUM' WHERE account_id = "+.@platinumAccountId+";");
   mes "Account "+.@platinumAccountId+" updated";
   mes "successfuly!";
   close;
  }
  else // If it's not VIP already, insert a new entry
  {
   mes "Account ID: "+.@accountId+".";
   sleep2 rand(100,850);
   query_sql("INSERT INTO vip_platinum (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
   sleep2 100;
   query_sql("UPDATE vip_platinum SET end_date = DATE_ADD(start_date, INTERVAL "+.@platinumDays+" DAY) WHERE account_id = "+.@accountId+";");
   query_sql("UPDATE `login` SET `level` = 1 WHERE `account_id` = "+.@accountId+";");
   query_sql("UPDATE login SET `account_type` = 'PLATINUM' WHERE account_id = "+.@accountId+";");
   mes "Account "+.@accountId+" updated";
   mes "successfuly!";
   close;
  }
 }
 close;
case 2: // Delete
 set .@getPlatinumList_1$,query_sql("SELECT account_name FROM vip_platinum LIMIT 0,127;", .@platinumList_1$);
 if ( getarraysize(.@platinumList_1$) == 0 )
 {
  mes "There are currently no VIP";
  mes "Platinum accounts.";
  close;
 }
 else
 {
  mes "Select the account you wish ";
  mes "to remove from VIP system Platinum.";

  set .@j$, "1. "+ .@platinumList_1$;
  for (set .@i,1; .@i < getarraysize(.@platinumList_1$); set .@i, .@i + 1 )
   set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@platinumList_1$[.@i];
  set .@j$, .@j$ +":Cancel";
  next;
  mes .@npcName$;
  mes "[VIP PLATINUM]";
  set .@menu, select(.@j$) -1;
  if ( .@menu == getarraysize(.@platinumList_1$) ) { next; goto On_gm; }
  mes "Are you sure you want to remove the account ";
  mes .@platinumList_1$[.@menu] +" ?";
  if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
  query_sql ("UPDATE `login` SET `level` = 0 WHERE `userid` = '"+.@platinumList_1$[.@menu]+"';");
  query_sql ("DELETE FROM vip_platinum WHERE account_name = '"+.@platinumList_1$[.@menu]+"';");
  query_sql("ALTER TABLE vip_platinum AUTO_INCREMENT = 1;");
  query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@platinumList_1$[.@menu]+"';");

  mes "VIP Platinum account successfuly deleted!.";
  close;
 }	
 close;

case 3: // List
 mes "List Accounts VIP Platinum:";
 set .@getplatinumList_1$,query_sql("SELECT account_name FROM vip_platinum LIMIT 0,127;", .@platinumList_1$);
 for (set .@i,0; .@i < getarraysize(.@platinumList_1$); set .@i, .@i + 1)
  mes (.@i+1)+". "+.@platinumList_1$[.@i];
 close;
case 4: // Back
 goto On_gm;
  }
 case 4: // Quit
  close;
}

terminateVip: // This function removes any VIP status from the specified account
set .@dbTableName$,getarg(0); // Table name
set .@accountId,getarg(1);  // Account ID

query_sql("UPDATE `login` SET `level` = 0 WHERE account_id = "+.@accountId+";"); // Set account level to 0
query_sql("DELETE FROM "+.@dbTableName$+" WHERE account_id = '"+.@accountId+"';"); // Delete VIP table entry
query_sql("ALTER TABLE "+.@dbTableName$+" AUTO_INCREMENT = 1;"); // Tries to reset id count
query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `account_id` = "+.@accountId+";"); // Set account type to "NORMAL" in 'login' table
goto L_displayInfo;
}

Any help will be much appreciated :D

Zanks yow !!

Edited by Angry Mjoo
Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  102
  • Reputation:   4
  • Joined:  12/05/11
  • Last Seen:  

not working.... already add the sql table... did i missing something?

Sorry... I dont read mysql query... it need login id... not a nick player's

Edited by Kaito Kid
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  11/03/12
  • Last Seen:  

this is for life time VIP Sir? i want only 1 character for VIP :) how can i edit the Script Emistry ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  37
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Hey bro i download and install that script with the sql file, but i have this problem.

 

Can you help me plx.

 

thump_8552079error-cuentas-vip.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  58
  • Topics Per Day:  0.01
  • Content Count:  208
  • Reputation:   1
  • Joined:  01/06/12
  • Last Seen:  

just edit level to group_id

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  37
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Yeah thx Blazing Spear that fixed the DB but i still have the debug problem, do you kwon how can fix that.

 

thump_8552116error-cuentas-vip.png

 

--------------------------------------------------------------------------------------------------------------------------------------------------

 

Fixed i see in the script that is missing the exp rate and item rate 

 

Original part of script

L_displayInfo:
    dispbottom "----------------------------------------------------------------------";
    dispbottom "Tipo de Cuenta:"+.@accountType$;
    dispbottom "Estado:        "+.@vipStatus$;
    dispbottom "Acaba en  :    "+.@expirationDate$;
    dispbottom "----------------------------------------------------------------------";
    end;
            
terminateVip:    // Remueve el status de la cuenta
    set .@dbTableName$,getarg(0);    //    Table name
    set .@accountId,getarg(1);        //    Account ID
    
    query_sql("UPDATE `login` SET `level` = 0 WHERE account_id = "+.@accountId+";"); // Coloca la cuenta a nivel 0
    query_sql("DELETE FROM "+.@dbTableName$+" WHERE account_id = '"+.@accountId+"';"); // Borra la cuenta
    query_sql("ALTER TABLE "+.@dbTableName$+" AUTO_INCREMENT = 1;"); // Reseta la id
    query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `account_id` = "+.@accountId+";"); // Coloca en la tabla en normal
    goto L_displayInfo;
    
OnPCLoginEvent:
    // Odtiene la data de las tablas SQL
    set .@getAccountType$,query_sql("SELECT `account_type` FROM login WHERE `account_id` = "+getcharid(3)+";",.@accountType$);
    sc_end sc_expboost;    
    sc_end sc_itemboost;
    
    if (.@accountType$ == "PLATINUM")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_platinum` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Get account type status
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_platinum WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Get expiration date
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // If current date is higher than expiration date...
        {
            callsub terminateVip,"vip_platinum",getcharid(3); goto L_displayInfo;
        }
        else
        {
            sc_start sc_expboost,1000*60*60*24,"+$VIPs_PlatinumExpRate+";
            sc_start sc_itemboost,1000*60*60*24,"+$VIPs_PlatinumItemRate+"; 
              goto L_displayInfo;
                     
        }
    }
    
    if (.@accountType$ == "GOLD")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_gold` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_gold WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiracion...
        {
            callsub terminateVip,"vip_gold",getcharid(3); goto L_displayInfo;
        }
        else
        {
            sc_start sc_expboost,1000*60*60*24,"+$VIPs_GoldExpRate+";
            sc_start sc_itemboost,1000*60*60*24,"+$VIPs_GoldItemRate+"; goto L_displayInfo;
        }
    }
    
    if (.@accountType$ == "SILVER")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiracion...
        {
            callsub terminateVip,"vip_silver",getcharid(3); goto L_displayInfo;
        }
        //    si los beneficios no an acabado
        else
        {
            sc_start sc_expboost,1000*60*60*24,"+$VIPs_SilverExpRate+";
            sc_start sc_itemboost,1000*60*60*24,"+$VIPs_SilverItemRate+"; goto L_displayInfo;
        }
    }
    
    // Checa si la cuenta es normal
    if (.@accountType$ == "NORMAL")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %M %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        goto L_displayInfo;
    }
//---------------------------------------- NO TOCAR ---------------------------------------------

 

Edited part of script

L_displayInfo:
    dispbottom "----------------------------------------------------------------------";
    dispbottom "Tipo de Cuenta:"+.@accountType$;
    dispbottom "Estado:        "+.@vipStatus$;
    dispbottom "Acaba en  :    "+.@expirationDate$;
    dispbottom "----------------------------------------------------------------------";
    end;
            
terminateVip:    // Remueve el status de la cuenta
    set .@dbTableName$,getarg(0);    //    Table name
    set .@accountId,getarg(1);        //    Account ID
    
    query_sql("UPDATE `login` SET `level` = 0 WHERE account_id = "+.@accountId+";"); // Coloca la cuenta a nivel 0
    query_sql("DELETE FROM "+.@dbTableName$+" WHERE account_id = '"+.@accountId+"';"); // Borra la cuenta
    query_sql("ALTER TABLE "+.@dbTableName$+" AUTO_INCREMENT = 1;"); // Reseta la id
    query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `account_id` = "+.@accountId+";"); // Coloca en la tabla en normal
    goto L_displayInfo;
    
OnPCLoginEvent:
    // Odtiene la data de las tablas SQL
    set .@getAccountType$,query_sql("SELECT `account_type` FROM login WHERE `account_id` = "+getcharid(3)+";",.@accountType$);
    sc_end sc_expboost;    
    sc_end sc_itemboost;
    
    if (.@accountType$ == "PLATINUM")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_platinum` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Get account type status
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_platinum WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Get expiration date
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // If current date is higher than expiration date...
        {
            callsub terminateVip,"vip_platinum",getcharid(3); goto L_displayInfo;
        }
        else
        {
            sc_start sc_expboost,1000*60*60*24,200,"+$VIPs_PlatinumExpRate+";
            sc_start sc_itemboost,1000*60*60*24,200,"+$VIPs_PlatinumItemRate+"; 
              goto L_displayInfo;
                     
        }
    }
    
    if (.@accountType$ == "GOLD")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_gold` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_gold WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiracion...
        {
            callsub terminateVip,"vip_gold",getcharid(3); goto L_displayInfo;
        }
        else
        {
            sc_start sc_expboost,1000*60*60*24,100,"+$VIPs_GoldExpRate+";
            sc_start sc_itemboost,1000*60*60*24,100,"+$VIPs_GoldItemRate+"; goto L_displayInfo;
        }
    }
    
    if (.@accountType$ == "SILVER")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiracion...
        {
            callsub terminateVip,"vip_silver",getcharid(3); goto L_displayInfo;
        }
        //    si los beneficios no an acabado
        else
        {
            sc_start sc_expboost,1000*60*60*24,50,"+$VIPs_SilverExpRate+";
            sc_start sc_itemboost,1000*60*60*24,50,"+$VIPs_SilverItemRate+"; goto L_displayInfo;
        }
    }
    
    // Checa si la cuenta es normal
    if (.@accountType$ == "NORMAL")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %M %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiracion
        goto L_displayInfo;
    }
//---------------------------------------- NO TOCAR ---------------------------------------------
Edited by Capuche
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

-            sc_start sc_expboost,1000*60*60*24,"+$VIPs_PlatinumExpRate+";
+            sc_start sc_expboost,1000*60*60*24,$VIPs_PlatinumExpRate;

.. same typo for other sc_start

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   0
  • Joined:  08/22/13
  • Last Seen:  

Please answer Rebel's post. :( How can I make the npc visible? Where do I add the

 

mapname,x,y,face  script  VIP system  NPC#,{ ??? Please answer :(



BUMP PLEASE

Link to comment
Share on other sites


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

use invisible npc sprite "111"  or "-1" or floating npc ( dont have coordinate )

 

there is no need for you to make it visible...it's useless for player to see the npc since they are not going to have any chances to use the npc.

Edited by Emistry
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   0
  • Joined:  08/22/13
  • Last Seen:  

use invisible npc sprite "111"  or "-1" or floating npc ( dont have coordinate )

 

What I mean is how to make it visible sir?

use invisible npc sprite "111"  or "-1" or floating npc ( dont have coordinate )

 

there is no need for you to make it visible...it's useless for player to see the npc since they are not going to have any chances to use the npc.

 

Oh, so only GM can talk to it?
 
In it's current settings. Is this the right way to pm it?
 
Receivers tab: npc:VIP |  'message'
-    script    VIP    -1,{
//*********************************************************************
//    VIP System for eAthena servers Version 3.0
//*********************************************************************
//    It allows you to boost experience and drop rate for players who donate
//    for a specified amount of days.
//    It makes use of account's GM Levels to specify the account type,
//    by default values are these:
//        - Account Level 0 = Non VIP Account
//        - Account Level 1 = VIP Silver Account
//        - Account Level 2 = VIP Gold Account
//        - Account Level 3 = VIP Platinum Account
//    all of them, of course, customizable .
// ¡Therefore, you can also set =atcommands= for every account level in
// [yourserver]/conf/atcommand_athena.conf ! Isn't that great?! 
//    In other words, VIP players can have access to more @commands than
//    normal users if you want. This will add more value to the service.
//
//    Add, List, Modify and Remove VIP accounts via whisper to this NPC.
//    Manage VIP accounts in-game! Just whisper any text to the npc "vip"
//    to access the VIP management menu.
//
//    This script requires some database modifications for it to work,
//    check them at the original post where I posted this script.
//    URI:    
//
//    Created by: Victor H. Olvera (VicThor)
//    If you like this, please donate to paypal: [email protected]
//    I'd really like to make more scripts like this, so help if you can!
//
//    If you want any special modification or adaptation of this script,
//    please! feel free to e-mail me at [email protected] I'm $ure I can
//    provide you with something according to your need$ 
// Modify by java@rathenaorg or [email protected] ====> compatible for both servers
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//**************** VIP SYSTEM CONFIGURATION    *************************
set $VIPs_SilverAccLevel,1;        // Account Level assigned for VIP Silver        *
set $VIPs_GoldAccLevel,2;        // Account Level assigned for VIP Gold            *
set $VIPs_PlatinumAccLevel,3;    // Account Level assigned for VIP Platinum    *
set $VIPs_SilverExpRate,50;        // VIP Silver Exp Boost in % ( 1 = 1% )        *
set $VIPs_GoldExpRate,100;        // VIP Gold Exp Boost in % ( 1 = 1% )            *
set $VIPs_PlatinumExpRate,150;    // VIP Platinum Exp Boost in % ( 1 = 1% )        *
set $VIPs_SilverItemRate,10;        // VIP Silver Item Drop Boost in % ( 1 = 1% )    *
set $VIPs_GoldItemRate,20;        // VIP Gold Item Drop Boost in % ( 1 = 1% )    *
set $VIPs_PlatinumItemRate,30;    // VIP Platinum Item Drop Boost in % ( 1 = 1%)*
set $VIPs_AdminGmLevel,99;        // Define GM Level enabled to add, list and    *
                            // remove VIP entries. Any GM with access le-    *
                            // vel equal or higher than this will be able    *
                            // to manage VIP Accounts.                        *
//    ********************************************************************
//
// Actions and checks when player logs in about his/her account type status.
OnPCLoginEvent:
    // Obtain account data
    set .@getAccountType$,query_sql("SELECT `account_type` FROM login WHERE `account_id` = "+getcharid(3)+";",.@accountType$);
    
    // First of all deACTIVEte all VIP benefits
    sc_end sc_expboost;    
    sc_end sc_itemboost;
    
    // If account type is PLATINUM
    if (.@accountType$ == "PLATINUM")
    {
    
        // Dialy Bonus WOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ================================================================
        if(#dailytimer < gettimetick(2)) {
            announce "Here's your prize, you'll get another one after 24 hours.",bc_self,0x0099FF;
            getitem 21001,1; //remove <id> and add your own ids for item
            set #dailytimer,gettimetick(2) + 86400; //24 hours.
        }
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_platinum` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Get account type status
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_platinum WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Get expiration date
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // If current date is higher than expiration date...
        {
            //    terminateVip function on line 430, removes player VIP entry from database table "vip_platinum"
            callsub terminateVip,"vip_platinum",getcharid(3); goto L_displayInfo;
        }
        //    If expiration date has not arrived yet, ACTIVEte VIP benefits.
        else
        {
            sc_start sc_expboost,1000*60*60*24,$VIPs_PlatinumExpRate;
            sc_start sc_itemboost,1000*60*60*24,$VIPs_PlatinumItemRate; goto L_displayInfo;
        }
    }
    
    if (.@accountType$ == "GOLD")
    {
    
        // Dialy Bonus WOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ================================================================
        if(#dailytimer < gettimetick(2)) {
            announce "Here's your prize, you'll get another one after 24 hours.",bc_self,0x0099FF;
            getitem 21001,1; //remove <id> and add your own ids for item
            set #dailytimer,gettimetick(2) + 86400; //24 hours.
        }
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_gold` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_gold WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiración
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiración...
        {
            //    terminateVip function on line 430, removes player VIP entry from database table "vip_gold"
            callsub terminateVip,"vip_gold",getcharid(3); goto L_displayInfo;
        }
        //    If expiration date has not arrived yet, ACTIVEte VIP benefits.
        else
        {
            sc_start sc_expboost,1000*60*60*24,$VIPs_GoldExpRate;
            sc_start sc_itemboost,1000*60*60*24,$VIPs_GoldItemRate; goto L_displayInfo;
        }
    }
    
    if (.@accountType$ == "SILVER")
    {
    
        // Dialy Bonus WOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ================================================================
        if(#dailytimer < gettimetick(2)) {
            announce "Here's your prize, you'll get another one after 24 hours.",bc_self,0x0099FF;
            getitem 21001,1; //remove <id> and add your own ids for item
            set #dailytimer,gettimetick(2) + 86400; //24 hours.
        }
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiración
        if (gettimestr("%Y %m %d",21) >= .@expirationDate$) // Si la fecha de HOY es mayor que la fecha de expiración...
        {
            //    terminateVip function on line 430, removes player VIP entry from database table "vip_silver"
            callsub terminateVip,"vip_silver",getcharid(3); goto L_displayInfo;
        }
        //    If expiration date has not arrived yet, ACTIVEte VIP benefits.
        else
        {
            sc_start sc_expboost,1000*60*60*24,$VIPs_SilverExpRate;
            sc_start sc_itemboost,1000*60*60*24,$VIPs_SilverItemRate; goto L_displayInfo;
        }
    }
    
    // If account type is normal, just display account type information.
    if (.@accountType$ == "NORMAL")
    {
        set .@getVipStatus,query_sql("SELECT `status` FROM `vip_silver` WHERE `account_id` = "+getcharid(3)+";",.@vipStatus$); // Obtener el estado de la cuenta
        set .@getExpirationDate$,query_sql("SELECT DATE_FORMAT(`end_date`, '%Y %M %d') FROM vip_silver WHERE `account_id` = "+getcharid(3)+";",.@expirationDate$);    // Obtener Fecha de expiración
        goto L_displayInfo;
    }

// Displays account type status on login on chat window.
L_displayInfo:
    dispbottom "----------------------------------------------------------------------";
    dispbottom "Account type:         "+.@accountType$;
    dispbottom "Status:                     "+.@vipStatus$;
    dispbottom "Expiration date: "+.@expirationDate$;
    dispbottom "----------------------------------------------------------------------";
    end;

OnWhisperGlobal:
    if ( getgmlevel() < 99 ) end;
    
On_gm:
    set .@npcName$,"[VIP System]";
    
    mes .@npcName$;
    mes "Welcome, "+strcharinfo(0)+"!";
    mes "¿What can I do for you today?";
    next;
    switch(select("VIP Silver Menu:VIP Gold Menu:VIP Platinum Menu:Quit"))
    {
        case 1:    // VIP Silver
            next;
            mes .@npcName$;
            mes "[VIP SILVER]";
            switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
            {
                case 1:    // Add/Extend
                    mes "Type the Account Name";
                    mes "you wish to add.";
                    input .@accountName$;
                    next;
                    mes .@npcName$;
                    mes "[VIP SILVER]";
                    mes "Type the number of days you";
                    mes "wish to add to the account's VIP";
                    mes "status.";
                    next;
                    mes .@npcName$;
                    mes "[VIP SILVER]";
                    input .@silverDays;
                    // Fetch account's ID using the name of the account previously typed.
                    set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
                    mes "Identifying account: "+.@accountName$+".";
                    sleep2 rand(100,2000); // Looks like it's working on something 
                    if (!.@accountId)    // Let's verify if the entered account exists or GM is just high...
                    {
                        mes "ERROR: Couldn't find account.";
                        mes "Verify if you dind't make a typo.";
                        close;
                    }
                    else
                    {     // Now lets check if the account is already 'vip_silver'
                        set .@getSilverAccount,query_sql("SELECT `account_id` FROM vip_silver WHERE `account_id` = "+.@accountId+";",.@silverAccountId);
                        if (.@silverAccountId == .@accountId) // If the account is already VIP we will update instead of inserting a new entry.
                        {
                            mes "Account ID: "+.@silverAccountId+".";
                            sleep2 rand(100,850);
                            query_sql("UPDATE vip_silver SET end_date = DATE_ADD(end_date, INTERVAL "+.@silverDays+" DAY) WHERE account_id = "+.@silverAccountId+";");
                            query_sql("UPDATE vip_silver SET `status` = 'ACTIVE' WHERE account_id = "+.@silverAccountId+";");
                            query_sql("UPDATE login SET `account_type` = 'SILVER' WHERE account_id = "+.@silverAccountId+";");
                            mes "Account "+.@silverAccountId+" updated";
                            mes "successfuly!";
                            close;
                        }
                        else    // If the account is not already a VIP Silver one, add a new entry.
                        {
                            mes "Account ID: "+.@accountId+".";
                            sleep2 rand(100,850);
                            query_sql("INSERT INTO vip_silver (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
                            sleep2 100;
                            query_sql("UPDATE vip_silver SET end_date = DATE_ADD(start_date, INTERVAL "+.@silverDays+" DAY) WHERE account_id = "+.@accountId+";");
                            query_sql("UPDATE `login` SET `group_id` = 1 WHERE `account_id` = "+.@accountId+";");
                            query_sql("UPDATE login SET `account_type` = 'SILVER' WHERE account_id = "+.@accountId+";");
                            mes "Account "+.@accountId+" added";
                            mes "successfuly!";
                            close;
                        }
                    }
                    close;
                case 2:    // Delete
                    set .@getSilverList_1$,query_sql("SELECT account_name FROM vip_silver LIMIT 0,127;", .@silverList_1$); // query_sql can only display the first 128 lines of a table. This is so sad 
                    if ( getarraysize(.@silverList_1$) == 0 )
                    {
                        mes "There are currently no VIP";
                        mes "Silver accounts.";
                        close;
                    }
                    else
                    {
                        mes "Select the account you wish ";
                        mes "to remove from VIP system.";
                        
                        set .@j$, "1. "+ .@silverList_1$;
                        for (set .@i,1; .@i < getarraysize(.@silverList_1$); set .@i, .@i + 1 )
                            set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@silverList_1$[.@i];
                        set .@j$, .@j$ +":Cancel";
                        next;
                        mes .@npcName$;
                        mes "[VIP SILVER]";
                        set .@menu, select(.@j$) -1;
                        if ( .@menu == getarraysize(.@silverList_1$) ) { next; goto On_gm; }
                        mes "Are you sure you want to remove the account ";
                        mes .@silverList_1$[.@menu] +" ?";
                        if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
                        query_sql ("UPDATE `login` SET `group_id` = 0 WHERE `userid` = '"+.@silverList_1$[.@menu]+"';");
                        query_sql ("DELETE FROM vip_silver WHERE account_name = '"+.@silverList_1$[.@menu]+"';");
                        query_sql("ALTER TABLE vip_silver AUTO_INCREMENT = 1;");
                        query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@silverList_1$[.@menu]+"';");
                        mes "VIP Silver account successfuly deleted!.";
                        close;
                    }                    
                    close;
                    
                case 3:    // List
                    mes "VIP Silver accounts list:";
                    // List up to 127 vip accounts
                    set .@getSilverList_1$,query_sql("SELECT account_name FROM vip_silver LIMIT 0, 127;", .@silverList_1$);
                    for (set .@i,0; .@i < getarraysize(.@silverList_1$); set .@i, .@i + 1)
                        mes (.@i+1)+". "+.@silverList_1$[.@i]; // You may want to add a next; command and a new LIMIT 128,255 sentence, in case you need to store and display more than 128 VIP accounts.
                    close;
                case 4:    // Back
                    goto On_gm;
            }
        
        case 2: // Gold Menu
            next;
            mes .@npcName$;
            mes "[VIP GOLD]";
            switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
            {
                case 1:    // Add
                    mes "Type the Account Name";
                    mes "you wish to add.";
                    input .@accountName$;
                    next;
                    mes .@npcName$;
                    mes "[VIP GOLD]";
                    mes "Enter the amount of days you";
                    mes "want to add to this account";
                    mes "status.";
                    next;
                    mes .@npcName$;
                    mes "[VIP GOLD]";
                    input .@goldDays;
                    // Fetch account's ID using the name of the account previously typed.
                    set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
                    mes "Identificando Cuenta: "+.@accountName$+".";
                    sleep2 rand(100,2000);
                    if (!.@accountId)    // Checks if account exists.
                    {
                        mes "ERROR: Couldn't find account.";
                        mes "Verify the account you typed";
                        close;
                    }
                    else
                    {     // Verify if account is already 'vip_gold'
                        set .@getGoldAccount,query_sql("SELECT `account_id` FROM vip_gold WHERE `account_id` = "+.@accountId+";",.@goldAccountId);
                        if (.@goldAccountId == .@accountId) // If it exists, update, not insert
                        {
                            mes "Account ID: "+.@accountId+".";
                            sleep2 rand(100,850);
                            query_sql("UPDATE vip_gold SET end_date = DATE_ADD(end_date, INTERVAL "+.@goldDays+" DAY) WHERE account_id = "+.@goldAccountId+";");
                            query_sql("UPDATE vip_gold SET `status` = 'ACTIVE' WHERE account_id = "+.@goldAccountId+";");
                            query_sql("UPDATE login SET `account_type` = 'GOLD' WHERE account_id = "+.@goldAccountId+";");
                            mes "Account "+.@goldAccountId+" updated";
                            mes "successfuly!";
                            close;
                        }
                        else    // If this account is not already 'vip_gold', add an entry.
                        {
                            mes "Account ID: "+.@accountId+".";
                            sleep2 rand(100,850);
                            query_sql("INSERT INTO vip_gold (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
                            sleep2 100;
                            query_sql("UPDATE vip_gold SET end_date = DATE_ADD(start_date, INTERVAL "+.@goldDays+" DAY) WHERE account_id = "+.@accountId+";");
                            query_sql("UPDATE `login` SET `group_id` = 2 WHERE `account_id` = "+.@accountId+";");
                            query_sql("UPDATE login SET `account_type` = 'GOLD' WHERE account_id = "+.@accountId+";");
                            mes "Account "+.@accountId+" updated";
                            mes "successfuly!";
                            close;
                        }
                    }
                    close;
                case 2:    // Delete
                    set .@getGoldList_1$,query_sql("SELECT account_name FROM vip_gold LIMIT 0,127;", .@goldList_1$);
                    if ( getarraysize(.@goldList_1$) == 0 )
                    {
                        mes "There are currently no VIP";
                        mes "accounts.";
                        close;
                    }
                    else
                    {
                        mes "Select the account you wish ";
                        mes "to remove from VIP system Gold.";
                        
                        set .@j$, "1. "+ .@goldList_1$;
                        for (set .@i,1; .@i < getarraysize(.@goldList_1$); set .@i, .@i + 1 )
                            set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@goldList_1$[.@i];
                        set .@j$, .@j$ +":Cancel";
                        next;
                        mes .@npcName$;
                        mes "[VIP GOLD]";
                        set .@menu, select(.@j$) -1;
                        if ( .@menu == getarraysize(.@goldList_1$) ) { next; goto On_gm; }
                        mes "Are you sure you want to remove the account ";
                        mes .@goldList_1$[.@menu] +" ?";
                        if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
                        query_sql ("UPDATE `login` SET `group_id` = 0 WHERE `userid` = '"+.@goldList_1$[.@menu]+"';");
                        query_sql ("DELETE FROM vip_gold WHERE account_name = '"+.@goldList_1$[.@menu]+"';");
                        query_sql("ALTER TABLE vip_gold AUTO_INCREMENT = 1;");
                        query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@goldList_1$[.@menu]+"';");
                        
                        mes "VIP Gold account successfuly deleted!.";
                        close;
                    }                    
                    close;
                    
                case 3:    // List
                    mes "List Accounts VIP Gold:";
                    // List only 128 accounts due to eAthena's limitations  very sad indeed.
                    set .@getgoldList_1$,query_sql("SELECT account_name FROM vip_gold LIMIT 0,127;", .@goldList_1$);
                    for (set .@i,0; .@i < getarraysize(.@goldList_1$); set .@i, .@i + 1)
                        mes (.@i+1)+". "+.@goldList_1$[.@i];
                    close;
                case 4:    // Back
                    goto On_gm;
            }
        case 3: // Menu VIP Platinum
            next;
            mes .@npcName$;
            mes "[VIP PLATINUM]";
            switch(select("Add/Extend Account:Delete Account:List Accounts:Back"))
            {
                case 1:    // Add
                    mes "Type the Account Name";
                    mes "you wish to add.";
                    input .@accountName$;
                    next;
                    mes .@npcName$;
                    mes "[VIP PLATINUM]";
                    mes "Enter the amount of days you";
                    mes "will add to this account's";
                    mes "status.";
                    next;
                    mes .@npcName$;
                    mes "[VIP PLATINUM]";
                    input .@platinumDays;
                    // Fetch account's ID using the name of the account previously typed.
                    set .@getAccountId,query_sql("SELECT `account_id`FROM login WHERE `userid` = '"+.@accountName$+"';",.@accountId);
                    mes "Identificando Cuenta: "+.@accountName$+".";
                    sleep2 rand(100,2000);
                    if (!.@accountId)    // Checks if account exists
                    {
                        mes "ERROR: Couldn't find this account";
                        mes "Enter the account correctly";
                        close;
                    }
                    else
                    {     // Is this account a 'vip_platinum' already?
                        set .@getPlatinumAccount,query_sql("SELECT `account_id` FROM vip_platinum WHERE `account_id` = "+.@accountId+";",.@platinumAccountId);
                        if (.@platinumAccountId == .@accountId) // If this account is 'vip_platinum' update instead of insterting a new entry.
                        {
                            mes "Account ID: "+.@accountId+".";
                            sleep2 rand(100,850);
                            query_sql("UPDATE vip_platinum SET end_date = DATE_ADD(end_date, INTERVAL "+.@platinumDays+" DAY) WHERE account_id = "+.@platinumAccountId+";");
                            query_sql("UPDATE vip_platinum SET `status` = 'ACTIVE' WHERE account_id = "+.@platinumAccountId+";");
                            query_sql("UPDATE login SET `account_type` = 'PLATINUM' WHERE account_id = "+.@platinumAccountId+";");
                            mes "Account "+.@platinumAccountId+" updated";
                            mes "successfuly!";
                            close;
                        }
                        else    // If it's not VIP already, insert a new entry
                        {
                            mes "Account ID: "+.@accountId+".";
                            sleep2 rand(100,850);
                            query_sql("INSERT INTO vip_platinum (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+.@accountId+",'"+.@accountName$+"','"+gettimestr("%Y-%m-%d",21)+"','"+gettimestr("%Y-%m-%d",21)+"','ACTIVE');");
                            sleep2 100;
                            query_sql("UPDATE vip_platinum SET end_date = DATE_ADD(start_date, INTERVAL "+.@platinumDays+" DAY) WHERE account_id = "+.@accountId+";");
                            query_sql("UPDATE `login` SET `group_id` = 3 WHERE `account_id` = "+.@accountId+";");
                            query_sql("UPDATE login SET `account_type` = 'PLATINUM' WHERE account_id = "+.@accountId+";");
                            mes "Account "+.@accountId+" updated";
                            mes "successfuly!";
                            close;
                        }
                    }
                    close;
                case 2:    // Delete
                    set .@getPlatinumList_1$,query_sql("SELECT account_name FROM vip_platinum LIMIT 0,127;", .@platinumList_1$);
                    if ( getarraysize(.@platinumList_1$) == 0 )
                    {
                        mes "There are currently no VIP";
                        mes "Platinum accounts.";
                        close;
                    }
                    else
                    {
                        mes "Select the account you wish ";
                        mes "to remove from VIP system Platinum.";
                        
                        set .@j$, "1. "+ .@platinumList_1$;
                        for (set .@i,1; .@i < getarraysize(.@platinumList_1$); set .@i, .@i + 1 )
                            set .@j$, .@j$ +":"+ (.@i+1) +". "+ .@platinumList_1$[.@i];
                        set .@j$, .@j$ +":Cancel";
                        next;
                        mes .@npcName$;
                        mes "[VIP PLATINUM]";
                        set .@menu, select(.@j$) -1;
                        if ( .@menu == getarraysize(.@platinumList_1$) ) { next; goto On_gm; }
                        mes "Are you sure you want to remove the account ";
                        mes .@platinumList_1$[.@menu] +" ?";
                        if ( select( "Yes:No" ) == 2 ) { next; goto On_gm; }
                        query_sql ("UPDATE `login` SET `group_id` = 0 WHERE `userid` = '"+.@platinumList_1$[.@menu]+"';");
                        query_sql ("DELETE FROM vip_platinum WHERE account_name = '"+.@platinumList_1$[.@menu]+"';");
                        query_sql("ALTER TABLE vip_platinum AUTO_INCREMENT = 1;");
                        query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `userid` = '"+.@platinumList_1$[.@menu]+"';");
                        
                        mes "VIP Platinum account successfuly deleted!.";
                        close;
                    }                    
                    close;
                    
                case 3:    // List
                    mes "List Accounts VIP Platinum:";
                    set .@getplatinumList_1$,query_sql("SELECT account_name FROM vip_platinum LIMIT 0,127;", .@platinumList_1$);
                    for (set .@i,0; .@i < getarraysize(.@platinumList_1$); set .@i, .@i + 1)
                        mes (.@i+1)+". "+.@platinumList_1$[.@i];
                    close;
                case 4:    // Back
                    goto On_gm;
            }
        case 4: // Quit
            close;
    }
    
terminateVip:    // This function removes any VIP status from the specified account
    set .@dbTableName$,getarg(0);    //    Table name
    set .@accountId,getarg(1);        //    Account ID
    
    query_sql("UPDATE `login` SET `group_id` = 0 WHERE account_id = "+.@accountId+";"); // Set account level to 0
    query_sql("DELETE FROM "+.@dbTableName$+" WHERE account_id = '"+.@accountId+"';"); // Delete VIP table entry
    query_sql("ALTER TABLE "+.@dbTableName$+" AUTO_INCREMENT = 1;"); // Tries to reset id count
    query_sql("UPDATE `login` SET `account_type` = 'NORMAL' WHERE `account_id` = "+.@accountId+";"); // Set account type to "NORMAL" in 'login' table
    goto L_displayInfo;
}

 

 

 

Can you check the script sir Emistry. I can't still even pm the npc :\

I already did the sql. :(

Edited by Emistry
changed to code bbcode.
Link to comment
Share on other sites


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

check for error and solve it

and make sure the account you using is GM LEVEL 99 ...

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...