It is currently July 19th, 2019, 3:58 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: JoinWorld Restrictions
PostPosted: May 16th, 2012, 6:40 am 

Joined: October 13th, 2011, 3:52 pm
Posts: 8
Location: The Netherlands
Used in my faction system but can be used for anything.
Place this method in the OnJoinWorld Event and you'll be able to either deny or allow the player to Join any world based on certain criteria.

Put this in a new class (static) so that it's accessible.
Note: might want to adjust the criteria and get rid of the faction code.
        public static Boolean CanJoin(World w, Player player, WorldChangeReason reason)
            if (w == null) return false;
            if (reason == WorldChangeReason.Bring) return true;
            if (w.Faction == 0) return true;
            if (player.Info.FactionOverride) return true;
            Faction worldFaction = getFaction(w.Faction);
            if (!worldFaction.getId().Equals(player.Info.Faction)) return false;
            return true;

Player.Networking.cs under the declaration of the variable useWorldSpawn are 3 methods.
By using an if-statement; check if the function returns either true or false and then do/return something.
if (!MyStaticClass.CanJoin(newWorld, this, reason)) return false;
     if( RaisePlayerJoiningWorldEvent( this, newWorld, reason, textLine1, textLine2 ) ) {

Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created