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 rimawi · Dec 24, 2013 at 01:34 PM · wwwhighscore

Displaying only 5 of the high scores

Hello, I am using the high score system from the wiki:http://wiki.unity3d.com/index.php?title=Server_Side_Highscores It works fine i can add high score and I can display it.

my question is: how can i check if the player got a high score greater than the lowest high score--I just want to display five only.

When i do a Debug.Log(hs_get.text);

it gives me name and score for every one not an integer:

how can i do something like this:

 if(score>lowestHighestScore){
 SHOW THE gui stuff to add the new score and name;
 }
 else{
 just show the score no gui;
 }

Thanks

Comment
Add comment · Show 1
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 ByteSheep · Dec 24, 2013 at 04:27 PM 0
Share

You appear to have two separate questions here:

  1. How do I only display 5 results?

  2. How do I find the value of the lowest high score returned? Your second question has been answered by Fred'sIphone.
    In addition to that, the way you would edit the php file to limit the returned highscores is by adding the extra lines:

    if($num_results > 5) { $num_results = 5; }

after the line:

 $num_results = mysql_num_rows($result);


in the display.php file.

This will make sure that you never get more than 5 results and is especially useful when the highscore list is already fairly long, since less data needs to be sent. Happy Holidays!

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer Wiki

Answer by fred_gds · Dec 24, 2013 at 03:57 PM

Well just search for scores in the Sring. So basicly check for String[0] if it is number, if so check if String[1] is also a number. and then you just add up all the numbers giving you back your score.

The easier way would be if you'd always enter something like aaa121340bbb while 121340 is your score and the aaa just indicate that your score starts there. And the bbb indicates that the score ends there. So you just need search where a aaa is and then take all the characters between the aaa and the first bbb which comes later on. Take those characters in a separate String and then you can convert that string to an int.

If you do so you should always keep in mind that hackers might find out about that technique so you might want to forbid the player to use aaa and bbb in their username ;)

that's the easiest solution I see.

Otherwise you could just modify the php script on the server side but I can't help you out with that ;)

Comment
Add comment · Show 1 · Share
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 rimawi · Dec 30, 2013 at 08:28 PM 0
Share

thank you both>> I decided to go with the second choice modify the php. I created a new php page the pulls one value only..the fifth highest ..then converted it to an int and compared it to the playerscore.. if the score less, the palyer doesnot have a choice to add his else he can.

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

20 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 avatar image avatar image

Related Questions

[Solved]WWW function issue on build. 2 Answers

Problem with WWW 2 Answers

WWW.getAudioClip() returning wrong length from one server but not another 0 Answers

Unload audio from external source 1 Answer

How to Load all textures with WWW class? But not with Assets Bundles 1 Answer


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