Page 1 of 1

Character Limits

Posted: Sun Sep 19, 2010 1:55 am
by xblade
hey guys is there a possiable way to set accounts to only have one character for players
But have a toggel so gms can have more than one?

Anyhelp is greatly appreciated :)

Re: Character Limits

Posted: Sun Sep 19, 2010 11:53 am
by atreiu
i dont know actually but you can try this
servspecopt.cfg
[CharacterSlots=(int {default 5})]

Re: Character Limits

Posted: Tue Sep 21, 2010 1:33 am
by Justae
Hello xblade,

You could try this small function, call it from your logon.src as soon as client logs on, something like

CheckSlots(who);

Code: Select all

use os;
use uo;

function CheckSlots(who);

  var CHAR_SLOTS := 5;	// Change to however many character slots your 'CharacterSlots=' is set to in servspecopt.cfg
  var acct := FindAccount(who.acct);
  if(!acct)
    return;
  endif

  var i;
  if(!who.cmdlevel)
    for(i := 2 to CHAR_SLOTS; i:= i + 1)
      if(acct.GetCharacter(i))
        acct.DeleteCharacter(i);
      endif
    endfor
  else
    for(i := 3 to CHAR_SLOTS; i:= i + 1)	// Allowing 2 character slots if character has cmdlevel > 0
      if(acct.GetCharacter(i))
        acct.DeleteCharacter(i);
      endif
    endfor			
  endif
	
endfunction
I have not tested it, but is should work.

Regards,
Justae.

Re: Character Limits

Posted: Tue Sep 21, 2010 9:53 am
by Tomi
servspecopt.cfg CharacterSlots= supports values of 1,5,6,7

Re: Character Limits

Posted: Sat Sep 25, 2010 10:01 pm
by xblade
Thanks Muchly Justae but i have encounted a few problems or iam doing it wrong.

I use the code you gave me and put it in the Logon.src
And the logon compiled fine , but it dosent limit the characters , ive try heaps of ways to figure this out but then again iam still a newbie when it comes to pol rather than Others including your self who have a better understanding than i do hehehe =P

If you could help me with this it would be Greatly appreciated! :D

Re: Character Limits

Posted: Wed Jun 12, 2013 6:06 am
by timginter
An Corp! ;)

Since I was looking for a way to limit characters and since CharacterSlots doesn't support custom values and doesn't even work with older POL releases (I'm working on 095 now :/) here's the code of a simple include file:

Code: Select all

use uo;
use os;

const MAX_CHAR_SLOTS := 2;

function CheckCharLimit(who)
	
	var acct, charSlot, charRef;
	var charCnt := 0;
	
  acct := FindAccount(who.acctname);
  if(!acct)
    return 1;
  endif
  
  for( charSlot := 1; charSlot <= 7 ; charSlot:= charSlot + 1 )
  	charRef := acct.GetCharacter(charSlot);
  	if( charRef )
			charCnt := charCnt + 1;
    endif
  	SleepMs(2);
  endfor
  
  if( charCnt > MAX_CHAR_SLOTS )
  	SendSysMessage(who, "Maximum number of characters per account: "+ MAX_CHAR_SLOTS, 0, 38);
  	SendSysMessage(who, "Delete additional characters to log in!", 0, 38);
	DisconnectClient(who);
  endif
  
  return 1;
endfunction
Add include "include/account.inc"; and CheckCharLimit(who) in /scripts/misc/logon.src and /scripts/misc/oncreate.src. Hope it comes in handy.

Re: Character Limits

Posted: Wed Jun 12, 2013 3:55 pm
by RusseL
Oh man, this topic is 3 years old... >_<

Re: Character Limits

Posted: Thu Jun 13, 2013 3:45 am
by Yukiko
RusseL wrote:Oh man, this topic is 3 years old... >_<
But still relevant apparently.