Jump to content
  • 0

This script activated via ITEM


Meister

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Good day!

I have this script "RO VIP System" made by VicThor which can be activated via GM or controlled by GM only. So, I'm requesting if it is possible to make this script item activated and instead of having the current settings, its settings will be..

  • Instead of 3 Account Level - It will be changed to 1 only. Account level 1
  • If Item is double clicked/used, player has the option whether to upgrade its account to 1 or not for a specific time (1 week). If player doesn't choose or undecided yet, the item will still be in his possession unless he/she decided to upgrade.
  • If player decided to upgrade, system will automatically change his/her account level and instantly reconnect him or kick him out of the game for upgrading purpose.
  • If player has his/her account upgraded, he/she can use the item again until its duration has expired.
  • And if possible for every time the player changes his map/location or every time he/she log-on to the game, its duration or expiration time is displayed at the top.
  • Hopefully I didn't miss any of the points that I would like to request.

E.G. of the item is like the guarantee refine script made by Euphy wherein it uses a callfunction if I'm not mistaken.

 

P.S. I've changed the content! Thanks again!

Here's VicThor's RO VIP script..
 

Link: http://pastebin.com/GjpCeZr4

Edited by Gnome
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

I don't see nothing wrong with a little bump and grind. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

I don't see nothing wrong with a little bump and grind. :D

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:  


/*
CREATE TABLE IF NOT EXISTS `vip_silver` (
  `account_id` int(11) unsigned NOT NULL default '0',
  `account_name` varchar(255) NOT NULL default 'NULL',
  `start_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `end_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `status` varchar(255) NOT NULL DEFAULT 'NULL',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;

ALTER table `login` add column account_type varchar(255) NOT NULL default 'NULL' after `birthdate`, add index (account_type);

*/

-	script	vipsystem8806azwan	-1,{

set $VIPs_SilverAccLevel,1;		// Account Level assigned for VIP Silver		*
set $VIPs_SilverExpRate,50;		// VIP Silver Exp Boost in % ( 1 = 1% )		*
set $VIPs_SilverItemRate,10;		// VIP Silver 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
	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$ != "SILVER" ) end;

	query_sql "SELECT DATE_FORMAT(`end_date`, '%Y %m %d') FROM vip_silver WHERE `account_id` = '"+ getcharid(3) +"'", .@expirationDate$;	// Get expiration date*
	if ( gettimestr("%Y %m %d",21) >= .@expirationDate$ )
		callsub terminateVip, "vip_silver", getcharid(3);
	else {
		sc_start sc_expboost,1000*60*60*24,$VIPs_PlatinumExpRate;
		sc_start sc_itemboost,1000*60*60*24,$VIPs_PlatinumItemRate; 
		sc_start SC_CP_WEAPON,1000*60*60*24,$VIPs_PlatinumItemRate;
		sc_start SC_CP_SHIELD,1000*60*60*24,$VIPs_PlatinumItemRate;
		sc_start SC_CP_ARMOR,1000*60*60*24,$VIPs_PlatinumItemRate;
		sc_start SC_CP_HELM,1000*60*60*24,$VIPs_PlatinumItemRate;
	}
	message strcharinfo(0), "Expiration date: "+ .@expirationDate$ ;
	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;

	if( select( "VIP Silver Menu", "Quit") -1 ) close;
	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.
			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'
				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` = "+ $VIPs_SilverAccLevel +" 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
			query_sql "SELECT account_name FROM vip_silver LIMIT 127", .@silverList_1$; // query_sql can only display the first 128 lines of a table. This is so sad 
			if ( !getarraysize( .@silverList_1$ ) )
			{
				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
			query_sql "SELECT `account_name` FROM vip_silver LIMIT 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;
	}
	
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
	message strcharinfo(0), "Account return to normal.";
	end;
}

function	script	VIP_upgrade	{
	if( select( "^777777~ Upgrade my account", "~ Not today^000000" ) -1 ) close;
	set .@acc_id, getcharid(3) ;

	query_sql "SELECT `userid`, `account_type` FROM `login` WHERE `account_id` = '"+ .@acc_id +"'", .@user_id$, .@acc_type$;
	// dispbottom .@user_id$+" "+.@acc_id;
	if ( .@acc_type$ == "SILVER" )
		query_sql "UPDATE vip_silver SET end_date = DATE_ADD(end_date, INTERVAL "+ getarg(0) +" DAY), `status` = 'ACTIVE' WHERE account_id = '"+ .@acc_id +"'";
	else {
		query_sql "INSERT INTO vip_silver (`account_id`,`account_name`,`start_date`,`end_date`,`status`) VALUES ("+ .@acc_id +",'"+ escape_sql( .@user_id$ ) +"','"+gettimestr("%Y-%m-%d",21)+"', ( DATE_ADD('"+ gettimestr("%Y-%m-%d",21) +"', INTERVAL "+ getarg(0) +" DAY) ), 'ACTIVE') ";
		query_sql "UPDATE `login` SET `group_id` = "+ $VIPs_SilverAccLevel +" WHERE `account_id` = '"+ .@acc_id +"'";
	}
	query_sql "SELECT DATE_FORMAT(`end_date`, '%Y %M %d') FROM vip_silver WHERE `account_id` = '"+ .@acc_id +"'", .@exp_Date$;
	query_sql "UPDATE login SET `account_type` = 'SILVER' WHERE account_id = '"+ .@acc_id +"'";
	message strcharinfo(0), "Account updated. Expiration : "+ .@exp_Date$;
	delitem getarg(1), 1;
	if( .@acc_type$ != "SILVER" ) {
		message strcharinfo(0), "You must relog.";
		sleep2 2000;
		if( playerattached() )
			atcommand "@kick "+ strcharinfo(0);
	}
	close;
}
Just one account (Silver account)

But I don't get what you want in this part

Quote

If player has his/her account upgraded, he/she can use the item again until its duration has expired.

If he use the item, the item would be delete ?

12703,Holy_Egg_2,Holy Egg,11,0,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc( "VIP_upgrade", 7, 12703 ); /* 7 days, item ID to delete */ },{},{}

EDIT : Fix a typo Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Done already. Used diconfrost vip system. Thanks for the help!

  • Upvote 1
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:  

Done already. Used diconfrost vip system. Thanks for the help!

 

/hum thanks to inform before I post

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  05/29/13
  • Last Seen:  

Dear Meister,

 

How GM sets the vip account? what npc I should whisper to?

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:  

Only GM lvl 99 or higher can set the vip account according to this setting :

set $VIPs_AdminGmLevel,99;

 

You must whispered the npc vipsystem8806azwan

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  308
  • Reputation:   3
  • Joined:  12/18/11
  • Last Seen:  

what if i use the 3 types of vip, what i need to add in the script?

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