Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 12-11-2014, 11:02 PM
prozacboy666 prozacboy666 is offline
Registered User
Join Date: Mar 2002
Posts: 130
prozacboy666 will become famous soon enough
Use SQL. Here is how I would do it.
When a new score comes in do a select on the database for the minimum score to get into the top20.
PHP Code:
SELECT MIN(scoreFROM myTable
If new score > min, insert new score into the database and delete the min score.
The only thing is you would have to do two queries to delete the min score from the database something like
PHP Code:
minId SELECT id FROM myTable WHERE score = (SELECT min(scoreFROM myTable)
DELETE FROM top20 WHERE id minId 
Then all you have to do is selects on that table if you are looking for the top20
PHP Code:
SELECT FROM top20 ORDER BY score DESC 
You probably could get the ID and delete it from the database all in one query but this should be fast enough.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.