Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Giannis7312777 · Sep 09, 2013 at 02:33 AM · networkingarraylistnetworkplayer

How to check if the player is already logged in

Hello everyone!

Is there any way to check if the player is already logged in the server? Like, if the username his player and a another player is trying to connect with the same username then tell that this user is already logged in. Can I do this with array list?

Thanks for reading, any help is appriciated :)

-John

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadoX · Sep 09, 2013 at 11:07 AM 1
Share

The idea is correct, but you can't really assume that if two players have the same name, that they're automatically the same person. (you might want to check their IPs for that). If it's for something simple as a shooter, you'd probably want to just ask the second player to change his nick or or display it on the server as something like "player[2]" (where [2] is added automatically)

How you want to handle this is pretty much up to you. You could send the player info to the server and check it on the server side to see if the player can log on with that info or have the player connect to the server no matter what and just do something else ins$$anonymous$$d once the player is already connected.

What have you tried and how did it work for you?

avatar image Giannis7312777 · Sep 09, 2013 at 12:01 PM 0
Share

I didn't tried anything yet. I think that I found a way to solve this with PHP. Also with PHP Im creating the accounts plus logging in. If that doesnt work then I will try your solution. But a question for your first solution[IP]: If the player is connected with the same IP the denie the second connect. But, if the player is logged in on his account and a another guy tries to access this account from a totaly different computer and IP then it will not denied it?

Thanks for the reply :)

avatar image ShadoX · Sep 09, 2013 at 01:01 PM 0
Share

Well, if you only would check the IP, then yes - he would be able to log on from more than one location. All that is up to you and how you want to handle it. You could just try checking if the user is logged in (either by userName or ID) and it should work just fine. There are a lot of scenarios how you could handle this. It really depends on what you really want and what type of game you're working. If you simply want to check if the player is already logged in then you would most probably just mark some variable on the server for the player as being logged in and check that value when logging in.

avatar image Giannis7312777 · Sep 09, 2013 at 01:40 PM 0
Share

So I will have to send to trough RPC ?

avatar image ShadoX · Sep 09, 2013 at 03:09 PM 1
Share

I'm not too familiar with RPC. You most probably can do that, but from what I have read on http://docs.unity3d.com/Documentation/Components/net-RPCDetails.html it's mot of a way to send out information to all connected clients which would be rather pointless in this case.

How exactly do you handle logging in? How do you send the request to the server? Are you using Unities built in server and client or have you written your own and how do you send information to clients?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

"Foreach" in an Array? 1 Answer

Storing instances of a script in a list. 0 Answers

How to use an Array list of classes inside a class? 1 Answer

How can I check if ALL items in an array/list meet a condition? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges