Jump to content
  • 0

N> script with groupid()?


blakbord

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  108
  • Reputation:   1
  • Joined:  02/10/12
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

-	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

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  108
  • Reputation:   1
  • Joined:  02/10/12
  • Last Seen:  

it's working, thanks a lot for this script you made.. but there is a problem with the script, GM ACCOUNT is affected.. how can I disable this for only GM ACCOUNT?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  108
  • Reputation:   1
  • Joined:  02/10/12
  • Last Seen:  

thanks for the fast reply, it's working now.. thank you so much for your help and for this script..

Edited by blakbord
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  108
  • Reputation:   1
  • Joined:  02/10/12
  • Last Seen:  

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