D
D
Demigodd2017-03-07 21:51:35
PHP
Demigodd, 2017-03-07 21:51:35

Online Highscore how to make names and values ​​not repeated?

Created an Online Highscore based on this video tutorial
www.youtube.com/watch?v=UvKLmQ6VAtg

public void SaveScores()
  {	
    uniqueID = "A"+Random.Range(1,30000000).ToString(); 

    name3 = userName.text;

    score = Mathf.Round (scoreValue.scoreman);
  }

This is what I'm sending instead of updateOnlineHighscoreData()
When clicking on PostScores , you can endlessly send the player's name and score, how can I limit this? Well, I don’t know, for example, if the player again displayed the same name for sending, then an error popped up, but there is one NO if he wants to update his data, what then?
In general, who is aware of the Online Highscore table, I will forgive you to help with this issue.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pparma, 2017-03-08
@Demigodd

If you want to allow the player to update their score, generate a key locally with the user that is unique and permanent. Send the key along with new results. When writing to the database, check if the name-key matches, if it matches, update the result.
With the uniqueness of names, everything is as simple as that, either make the name field in the database unique and then the database will not allow you to make a duplicate by issuing an appropriate error, or before adding an entry to the database, check whether there is already such a name in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question