Jump to content
  • 0
kukayasko

If table = 0, then VIP

Question

 

Hi guys!

I don't know how to transcript this in codes, but that is my logarithm idea:

(no programming language, just logarithm)

ON LOGIN:
	{Check login, table_vipfree} // SQL TABLE
	If table_vipfree = 1 then
	end
	If table_vipfree = 0 then
	Adjust GM Level of account = 1
	Change table_vipfree to 1
	Set timer for GM Level = 7200 // 7200 Minutes = 5 days
	mes "You get free VIP for 5 days, please disconnect.........................."
	mes "msg msg msg"
	end
Edited by kukayasko

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Well, how it can work: 

this script will check if the table "vipfree" is 0 or 1.

If the value is 0, means that the player is new (this script never runned for him), then will add "adjgroup 1" to account for 5 days and change the value of "vipfree" to 1, which means that this script will never run again.

 

Ok, now. How I can make it works?

Also, I don't know how to add this table.

It's just my idea õ/

Share this post


Link to post
Share on other sites
  • 0
-	script	AutoVIP	FAKE_NPC,{

OnPCLoginEvent:
	// save the original group
	@ACTUAL_GROUP = getgroupid();

	// check if the player was never a VIP
	if (##VIP_UNTIL < 1) {
		// give the free VIP status
		##VIP_UNTIL = gettimetick(2) + .free_vip_length;
	}

	// check if the player is currently a VIP
	if (##VIP_UNTIL > gettimetick(2)) {
		// move the player to the VIP group until logout
		setgroupid(.vip_group);

		// notify the player
		dispbottom("You are a VIP player.");

		// schedule a timer to revert the group on expiration
		addtimer((##VIP_UNTIL - gettimetick(2)) * 1000, strnpcinfo(0) + "::OnExpire");
	}

	// check if the player was a VIP but it expired while away
	else if (##VIP_UNTIL > 1) {
		goto OnExpire;
	}
end;

OnExpire:
	if (##VIP_UNTIL <= gettimetick(2)) {
		// revert to the original group
		setgroupid(@ACTUAL_GROUP);

		// notify the player
		dispbottom("Your VIP status expired. You are now a normal player.");

		// update the variable
		##VIP_UNTIL = 1;
	}
end;



/////////// Configuration below
OnInit:
	.vip_group = 1; // the ID of your VIP group
	.free_vip_length = (((60 * 60) * 24) * 5); // the length of the free VIP period (5 days)
}

 

Share this post


Link to post
Share on other sites
  • 0
17 hours ago, meko said:

-	script	AutoVIP	FAKE_NPC,{

OnPCLoginEvent:
	// save the original group
	@ACTUAL_GROUP = getgroupid();

	// check if the player was never a VIP
	if (##VIP_UNTIL < 1) {
		// give the free VIP status
		##VIP_UNTIL = gettimetick(2) + .free_vip_length;
	}

	// check if the player is currently a VIP
	if (##VIP_UNTIL > gettimetick(2)) {
		// move the player to the VIP group until logout
		setgroupid(.vip_group);

		// notify the player
		dispbottom("You are a VIP player.");

		// schedule a timer to revert the group on expiration
		addtimer((##VIP_UNTIL - gettimetick(2)) * 1000, strnpcinfo(0) + "::OnExpire");
	}

	// check if the player was a VIP but it expired while away
	else if (##VIP_UNTIL > 1) {
		goto OnExpire;
	}
end;

OnExpire:
	if (##VIP_UNTIL <= gettimetick(2)) {
		// revert to the original group
		setgroupid(@ACTUAL_GROUP);

		// notify the player
		dispbottom("Your VIP status expired. You are now a normal player.");

		// update the variable
		##VIP_UNTIL = 1;
	}
end;



/////////// Configuration below
OnInit:
	.vip_group = 1; // the ID of your VIP group
	.free_vip_length = (((60 * 60) * 24) * 5); // the length of the free VIP period (5 days)
}

 

Wow, you gave it on my hands for free. Thanks so much!!!

Nice work ^.^

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.