Jump to content
  • 0
blakbord

N> script with groupid()?

Question

I want a script that has to do with groupid(),

scenario goes like this:

 

when a player make a new account his groupid is groupid(0) as default

when he LOGIN in the game, I want his groupid to be  groupid(1)

 

groupid(1) = special account that is good for 1 week

 

hope that someone can help me about this script.. thanks in advance..

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Add this getgroupid check at the beginning:

 

-	script	vip_for_1week	-1,{
OnPCLoginEvent:
	if (getgroupid() != 0) end;
	
	// first time logging into this account
	if (#VIP_expire == 0) {
		set #VIP_expire, gettimetick(2) + (7*86400); // 7 days
		dispbottom "Welcome to the server!";
		dispbottom "You have been upgraded to a VIP for 1 week.";
	}
	
	if (#VIP_expire > gettimetick(2)) {
		// they still have time left
		dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
		atcommand "@adjgroup 1";
		deltimer strnpcinfo(3)+"::OnPCLoginEvent";
		if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
			addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnPCLoginEvent";
		} else {
			addtimer 2147483000, strnpcinfo(3)+"::OnPCLoginEvent";
		}
	} else if (#VIP_expire > 1) {
		set #VIP_expire, 1;
		atcommand "@adjgroup 0";
		dispbottom "Your VIP Rental has expired.";
	}
	end;
}
Link to comment
Share on other sites

  • 0

-	script	vip_for_1week	-1,{
OnPCLoginEvent:
	// first time logging into this account
	if (#VIP_expire == 0) {
		set #VIP_expire, gettimetick(2) + (7*86400); // 7 days
		dispbottom "Welcome to the server!";
		dispbottom "You have been upgraded to a VIP for 1 week.";
	}
	
	if (#VIP_expire > gettimetick(2)) {
		// they still have time left
		dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
		atcommand "@adjgroup 1";
		deltimer strnpcinfo(3)+"::OnPCLoginEvent";
		if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
			addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnPCLoginEvent";
		} else {
			addtimer 2147483000, strnpcinfo(3)+"::OnPCLoginEvent";
		}
	} else if (#VIP_expire > 1) {
		set #VIP_expire, 1;
		atcommand "@adjgroup 0";
		dispbottom "Your VIP Rental has expired.";
	}
	end;
}
The values of the variable #VIP_expire

0 = they never logged in

1 = they used VIP for 1 week and now it's over

gettimetick(2) = VIP is active and that's the UNIX time when it expires

Link to comment
Share on other sites

  • 0

Add this getgroupid check at the beginning:

 

-	script	vip_for_1week	-1,{
OnPCLoginEvent:
	if (getgroupid() != 0) end;
	
	// first time logging into this account
	if (#VIP_expire == 0) {
		set #VIP_expire, gettimetick(2) + (7*86400); // 7 days
		dispbottom "Welcome to the server!";
		dispbottom "You have been upgraded to a VIP for 1 week.";
	}
	
	if (#VIP_expire > gettimetick(2)) {
		// they still have time left
		dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
		atcommand "@adjgroup 1";
		deltimer strnpcinfo(3)+"::OnPCLoginEvent";
		if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
			addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnPCLoginEvent";
		} else {
			addtimer 2147483000, strnpcinfo(3)+"::OnPCLoginEvent";
		}
	} else if (#VIP_expire > 1) {
		set #VIP_expire, 1;
		atcommand "@adjgroup 0";
		dispbottom "Your VIP Rental has expired.";
	}
	end;
}

I want to use this script in an item for example..

670,Gold_Coin_Moneybag,Bag of Gold Coins,0,100000,,400,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}

thanks..

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

Important Information

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