user.getName() == "username" doesnt work

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Sinkist
Posts: 9
Joined: 02 May 2017, 12:56

user.getName() == "username" doesnt work

Postby Sinkist » 02 May 2017, 16:17

Hey,
i cant get what is wrong with this:

Code: Select all

      User user = (User) arg0.getParameter(SFSEventParam.USER);
      
      trace("..........................................");
      trace(user.getName());
      trace("..........................................");
      
      if(user.getName() == "Dex2"){
         Vec3D newPos = new Vec3D(0, 0, 0);
         SFSMMOApi mmoApi = (SFSMMOApi) SmartFoxServer.getInstance().getAPIManager().getMMOApi();
         mmoApi.setUserPosition(user, newPos, getParentExtension().getParentZone().getRoomByName("City"));
         
         trace("Gamemaster has joined!");
      }


Between the dots it prints out Dex2. And Dex2 is the username i can see in the console and zone monitor.

But the if-clause never fires true?
Why?

regards
User avatar
Lapo
Site Admin
Posts: 20216
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: user.getName() == "username" doesnt work

Postby Lapo » 03 May 2017, 07:16

Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 7 guests