Port on login

For any problems with Dawn of Light website or game server, please direct questions and problems here.

Moderator: Support Team

Port on login

Postby Galroth » Fri Aug 15, 2014 6:39 pm

Hello Guys!


I want plvl1 accounts to get instant ported, on login.. But on plvl2/3, i do not want instant port on login.

Can any1 help me, on how to add it to this code? Can't figure it atm :o


I have added this to DOLtestserver.cs
Code: Select all
//After registering for the OnPlayerEnterWorldFirstTime event this //function is called whenever a character enters the game public static void DOLTestPlayerEnterWorld(DOLEvent e, object sender, EventArgs args) { GamePlayer player = sender as GamePlayer; if (player == null) return; //We send a nice output message to the player when he enters the game //player.Out.SendMessage("", eChatType.CT_Important, eChatLoc.CL_SystemWindow); if (player.Realm == eRealm.Albion) { player.MoveTo(200, 475887, 344040, 4103, 142); player.Bind(true); } else if (player.Realm == eRealm.Midgard) { player.MoveTo(200, 475146, 294713, 3848, 604); player.Bind(true); } else if (player.Realm == eRealm.Hibernia) { { player.MoveTo(200, 438352, 367983, 4136, 973); player.Bind(true); { } } } }
Insane PvP - Admin & Creator

The Ministry - Old Frontiers
Galroth
DOL Apprentice
 
Posts: 41
Joined: Sat Mar 10, 2007 7:29 pm

Re: Port on login

Postby Carnifexe » Fri Aug 15, 2014 7:18 pm

Code: Select all
if (player.Realm == eRealm.Albion && player.Client.Account.PrivLevel == 1) { player.MoveTo(200, 475887, 344040, 4103, 142); player.Bind(true); }
something like that ?
:shock: :roll: :P

Or better and a bit more clean
Code: Select all
public static void DOLTestPlayerEnterWorld(DOLEvent e, object sender, EventArgs args) { GamePlayer player = sender as GamePlayer; if (player == null) return; if (player.Client.Account.PrivLevel == 1) { switch (player.Realm) { case eRealm.Albion: { player.MoveTo(200, 475887, 344040, 4103, 142); break; } case eRealm.Midgard: { player.MoveTo(200, 475146, 294713, 3848, 604); break; } case eRealm.Hibernia: { player.MoveTo(200, 438352, 367983, 4136, 973); break; } } } }
Boss and Coder of Ariadolis
User avatar
Carnifexe
DOL Experienced
 
Posts: 194
Joined: Sun Sep 25, 2005 11:54 pm
Location: Hamburg / Germany

Re: Port on login

Postby Galroth » Fri Aug 15, 2014 8:08 pm

YES! - Perfect!

I tried something like this if (player.Client.Account.PrivLevel != 1) .. Didnt work out that well :))



DOLtestserver.cs - For everyone else, script to port to xx locations on startup.
Code: Select all
/* * DAWN OF LIGHT - The first free open source DAoC server emulator * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /* * Author: SmallHorse * Date: 10th August, 2004 * This script should be put in /scripts/gameevents directory. * This event script demonstractes how to set callback functions * for some global server events as well as how to display a * custom dialog to the player and react to the response! */ using System; using System.Reflection; using DOL.Events; using DOL.GS.PacketHandler; using log4net; namespace DOL.GS.GameEvents { //First, declare our Event and have it implement the IGameEvent interface public class DOLTestServer { /// <summary> /// Defines a logger for this class. /// </summary> private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //This function is implemented from the IGameEvent //interface and is called on serverstart when the //events need to be initialized [ScriptLoadedEvent] public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_EXAMPLES) return; //We want to be notified whenever a new character is created GameEventMgr.AddHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(DOLTestCharacterCreation)); //We want to be notified whenever a player enters the world GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(DOLTestPlayerEnterWorld)); /* Not yet ;-) NonEnterableArea area1 = new NonEnterableArea("Teleport Area", 535405, 479515, 0, 2000); area1.Mode = eNonEnterableAreaMode.Teleport; NonEnterableArea area2 = new NonEnterableArea("Damage Area", 538405, 479515, 0, 2000); area2.Mode = eNonEnterableAreaMode.Damage; NonEnterableArea area3 = new NonEnterableArea("Instant Kill Area", 540405, 479515, 0, 2000); area3.Mode = eNonEnterableAreaMode.InstantKill; WorldMgr.GetRegion(1).AddArea(area1); WorldMgr.GetRegion(1).AddArea(area2); WorldMgr.GetRegion(1).AddArea(area3); */ //Output success message if (log.IsInfoEnabled) log.Info("DOLTestServer initialized"); } [ScriptUnloadedEvent] public static void OnScriptUnloaded(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_EXAMPLES) return; GameEventMgr.RemoveHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(DOLTestCharacterCreation)); GameEventMgr.RemoveHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(DOLTestPlayerEnterWorld)); } //After registering for the OnPlayerEnterWorldFirstTime event this //function is called whenever a character enters the game public static void DOLTestPlayerEnterWorld(DOLEvent e, object sender, EventArgs args) { GamePlayer player = sender as GamePlayer; if (player == null) return; //We send a nice output message to the player when he enters the game //player.Out.SendMessage("", eChatType.CT_Important, eChatLoc.CL_SystemWindow); if (player.Client.Account.PrivLevel == 1) { switch (player.Realm) { case eRealm.Albion: { player.MoveTo(200, 475887, 344040, 4103, 142); break; } case eRealm.Midgard: { player.MoveTo(200, 475146, 294713, 3848, 604); break; } case eRealm.Hibernia: { player.MoveTo(200, 438352, 367983, 4136, 973); break; } } } } //After registering for the OnCharacterCreation Event this function //is called whenever a new character is created! public static void DOLTestCharacterCreation(DOLEvent e, object sender, EventArgs args) { CharacterEventArgs chArgs = args as CharacterEventArgs; if (chArgs == null) return; //We want our new characters to start with some money //chArgs.Character.Gold = 10; //chArgs.Character.Silver = 50; // since at least money loot is available we dont need start money } } }
Insane PvP - Admin & Creator

The Ministry - Old Frontiers
Galroth
DOL Apprentice
 
Posts: 41
Joined: Sat Mar 10, 2007 7:29 pm

Re: Port on login

Postby Carnifexe » Fri Aug 15, 2014 8:29 pm

YES! - Perfect!
I tried something like this if (player.Client.Account.PrivLevel != 1) .. Didnt work out that well :))
Why you try to use: if (player.Client.Account.PrivLevel != 1)

this means nothing else like: if (player.Client.Account.PrivLevel !=(IS NOT) 1)
with that you checked ONLY ADMIN will be port and normal players wont :)
Boss and Coder of Ariadolis
User avatar
Carnifexe
DOL Experienced
 
Posts: 194
Joined: Sun Sep 25, 2005 11:54 pm
Location: Hamburg / Germany

Re: Port on login

Postby Galroth » Fri Aug 15, 2014 8:52 pm

Ahh! i c!

Well, that makes sense now! hah :)

Thanks for the help, and explaining!
Insane PvP - Admin & Creator

The Ministry - Old Frontiers
Galroth
DOL Apprentice
 
Posts: 41
Joined: Sat Mar 10, 2007 7:29 pm


Return to “%s” Support

Who is online

Users browsing this forum: No registered users and 1 guest