How do I add a number to a username if it already exists?

0 favourites
  • 2 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • I am using the photon multiplayer plugin and everything works great except for this one problem I am having:

    When a user enters a room and has chosen the same userid (username) as another user it simply shows up as blank.

    Is there any way to check, upon entering a room, if another user already is using the same name/id so that it can set a new username for the user?

    For example, if someone with the name "Player" entered a room and someone else was already in the room also using the name "Player" I would want to have the entering user's name be Player(1). If there were two other players with the name "Player" already in the room then the third player's name would be Player(2) etc...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The first question would be how you are storing the username.

    Are you storing it as a global variable or as a dicitonary value or as an XML value?

    The way you would check whether the name already exists, varies depending on how you store the usernames for your chatroom.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)