If table = 0, then VIP

kukayasko

New member
Messages
44
Points
0
Hi guys!

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

(no programming language, just logarithm)

Code:
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
 
Last edited by a moderator:
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 õ/

 
Code:
-	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)
}
 
Last edited by a moderator:
- 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 ^.^

 
Back
Top