Page 1 of 1

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

Posted: 02 May 2017, 16:17
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

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

Posted: 03 May 2017, 07:16
by Lapo