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

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

Moderators: Lapo, Bax

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

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

Post by Sinkist »

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: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

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

Post by Lapo »

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