Joining the wrong zone

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Joining the wrong zone

Postby potmo » 17 Oct 2008, 13:47

Hi!

I have two zones called "couronnegold" and "px" in my config.xml

Code: Select all

<Zones>   
      <Zone name="couronnegold" uCountUpdate="false" emptyNames="false" customLogin="true">
         <Rooms></Rooms>
         <Extensions>
            <extension name="A" className="se.raketspel.smartbox.core.ExtensionCore" type="java"/>
         </Extensions>
      </Zone>
      <Zone name="px" uCountUpdate="false" emptyNames="false" customLogin="true">
         <Rooms></Rooms>
         <Extensions>
            <extension name="pxsomething" className="se.raketspel.smartbox.core.ExtensionCore" type="java"/>
         </Extensions>
      </Zone>
   </Zones>


The problem is that when I join the zone called "couronnegold" I end up in the zone called "px".

This is the xml-data sent from the client to join the zone
<msg t='sys'><body action='login' r='0'><login z='couronnegold'><nick><![CDATA[Frank]]></nick><pword><![CDATA[]]></pword></login></body></msg>


In my zone extension code I have a code snippet printing out the joined zone:

Code: Select all

   public void handleInternalEvent(InternalEventObject event) {
      String eventName = event.getEventName();
      try {
         if (eventName.equals("loginRequest")) {
            System.out.println("Trying to join zone: " + zoneName);
...
...


this prints out
Trying to join zone: px


What is the problem here? I suspect that it is that both zone-extensions are using the same class. But I must be able to do this right?

Serverversion: 1.6.1

Thanks in advance.
Nisse Bergman
Raketspel
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Oct 2008, 18:06

In your code where does zoneName comes frome? How and when is it created?
Additionally when yoy handle the "loginRequest" event you get the name of the zone requested.

Code: Select all

String zoneName = event.getParam("zone")
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Postby potmo » 20 Oct 2008, 07:04

I found it I think.

the variable "zone" was declared as
private static Zone zone;

Stupid. Its the littlest errata that makes the biggest headache.

Thanks!
Nisse Bergman

Raketspel

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 39 guests