Character Limits

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
xblade
New User
Posts: 18
Joined: Thu Sep 02, 2010 4:47 am

Character Limits

Post 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 :)
User avatar
atreiu
Grandmaster Poster
Posts: 151
Joined: Mon May 24, 2010 1:08 pm
Location: Russia, Moscow

Re: Character Limits

Post by atreiu »

i dont know actually but you can try this
servspecopt.cfg
[CharacterSlots=(int {default 5})]
Justae
Expert Poster
Posts: 79
Joined: Thu May 24, 2007 2:12 pm
Location: South Africa

Re: Character Limits

Post 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.
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: Character Limits

Post by Tomi »

servspecopt.cfg CharacterSlots= supports values of 1,5,6,7
xblade
New User
Posts: 18
Joined: Thu Sep 02, 2010 4:47 am

Re: Character Limits

Post 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
User avatar
timginter
Neophyte Poster
Posts: 37
Joined: Tue Apr 22, 2008 6:25 am

Re: Character Limits

Post 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.
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Character Limits

Post by RusseL »

Oh man, this topic is 3 years old... >_<
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Character Limits

Post by Yukiko »

RusseL wrote:Oh man, this topic is 3 years old... >_<
But still relevant apparently.
Post Reply