Jump to content
  • 0

Premium account help needed


Question

Posted (edited)

Hello, I have basic npc that allows to become a premium user... But, I want to make some changes in it, and don't know how.

Here it is:

prontera,164,168,3	script	Премиум Сервис	618,{
// Settings: -----------------------------
set .@Cost, 1000; // Cash Points required
set .@Time, 1 * 7 * 24 * 60 * 60; // Time in Seconds = 4 weeks, 7 days per week, 24 hours per day, 60 minutes per day, 60 seconds per minute. = 1 month in this sample.
set .@Time$, "1 week";
// ---------------------------------------

mes "[Premium Account]";
mes "I am the premium account seller.";
if( #PremiumUser > gettimetick(2) )
	mes "Your premium account expires in ^FF0000" + callfunc("Time2Str",#PremiumUser) + "^000000.";
mes "What can I do for you?";
next;

// isPremium() returns 1 if the current user account is premium and it have not expired.
// It works together with #Premium_Tick, which is a account Var set with a Unix Time value, representing when the premium account expires.
// isPremium() is the same as #Premium_Tick > gettimetick(2)

switch( select("Pay for premium Time:About premium Account") )
{
case 1:
	mes "[Premium Account]";
	if( #PremiumUser > gettimetick(2) )
		mes "Do you really want to extend your premium Time?";
	else
		mes "You do really want to convert your account to premium?";

	mes "Premium Time is ^FF0000" + .@Time$ + "^000000";
	mes "Value is ^FF0000" + .@Cost + "^000000 Cash Points.";
	next;
	if( select("Yes:No") == 2 )
	{
		mes "[Premium Account]";
		mes "Come back if you change your mind.";
		close;
	}

	if( #CASHPOINTS < .@Cost )
	{
		mes "[Premium Account]";
		mes "You don't have enough Cash Points.";
		close;
	}

	if( #PremiumUser > gettimetick(2) )
		set #PremiumUser, #PremiumUser + .@Time; // Time Extension
	else
		set #PremiumUser, gettimetick(2) + .@Time; // New premium Account
		query_sql "UPDATE `login` SET group_id = '1' WHERE account_id = "+getcharid(3)+"";
		set #CASHPOINTS, #CASHPOINTS - .@Cost;
	mes "[Premium Account]";
	mes "Поздравляю!";
	mes "До истечения времени Премиум аккаунта осталось: ^FF0000" + callfunc("Time2Str",#PremiumUser) + "^000000.";
	next;		
	mes "Чтобы изменения статуса вступили в силу, пожалуйста, перезайдите в игру.";
	close;
case 2:

	// Edit this messages to explain your Users about the premium account in your server.
	// ----------------------------------------------------------------------------------

	mes "[Premium Account]";
	mes "Премиум аккаунты пока нахдятся в стадии разработки.";
	mes "";
	mes "";
	close;
}


OnPCLoginEvent:
if( #PremiumUser > gettimetick(2) ) {
//		sc_start SC_ITEMBOOST,( #PremiumUser - gettimetick(2) ),50;
//		sc_start SC_EXPBOOST,( #PremiumUser - gettimetick(2) ),50;
	dispbottom "До истечения времени Премиум аккаунта осталось: " + callfunc("Time2Str",#PremiumUser) + "";
	}
if( #PremiumUser <= gettimetick(2) ) {
	dispbottom "Premium time is over.";
//		query_sql "UPDATE `login` SET group_id = '0' WHERE account_id = "+getcharid(3)+"";
	}
end;
}

the clue is next: I want my premiums gain new group_id to get some commands work, thatswhy I need next: players loosing their premium status will loose their group_id as well.

What I want is: If player is GM (has gm level 2 or more) his group id will not be changed while becoming premium, cause I have playing moderators on my server. And, when premium time runs out, their group id wont change to 0... That's the basic stuff that I want to ask :) I think this isn't that hard to do, I just have no ideas how to do that... (

And, Is it possible not display the

dispbottom "Premium time is over.";

anytime player will log in if the premium time was run out? So, just once... than just remove #premiumuser from global reg table...

Kindly asking to help in this script. Thanks a lot anyway, waiting for you'r support )

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.

7 answers to this question

Recommended Posts

Posted
And, Is it possible not display the

dispbottom "Premium time is over.";

anytime player will log in if the premium time was run out? So, just once... than just remove #premiumuser from global reg table...

change

if( #PremiumUser <= gettimetick(2) ) {

to

if( #PremiumUser <= gettimetick(2) && getgroupid() == 1 ) {

What I want is: If player is GM (has gm level 2 or more) his group id will not be changed while becoming premium, cause I have playing moderators on my server. And, when premium time runs out, their group id wont change to 0... That's the basic stuff that I want to ask :) I think this isn't that hard to do, I just have no ideas how to do that... (

change

query_sql "UPDATE `login` SET group_id = '1' WHERE account_id = "+getcharid(3)+"";

to

if( !getgroupid() ) query_sql "UPDATE `login` SET group_id = '1' WHERE account_id = "+getcharid(3)+"";

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...