-
Notifications
You must be signed in to change notification settings - Fork 9
toplists
Toplists module provides fancy toplists in a menu. The lists show the Top players in database ordered by amount of Credits, amount of items, worth of items and worth total of items and credits.
sm_toplists - Show toplists menu
sm_topcredits - Show toplist of credit amount
sm_topitems - Show toplist of items amount
sm_topworth - Show toplist of item worth
sm_toptotal - Show toplist of total worth
// Max entrys to show in Toplist
// -
// Default: "10"
// Minimum: "1.000000"
mystore_toplist_max "10"
// If toplist is older thank x seconds query to database
// -
// Default: "300.0"
// Minimum: "5.000000"
mystore_toplist_update_interval "300.0"
On map start the plugin query the top users of the lists and store them in a array. When a player open a toplist and the time from last query is smaller then the ConVar mystore_toplist_update_interval the plugin will use the stored values from array otherwise it make a new query to database to update toplists.
SQL:
SELECT name, credits FROM mystore_players ORDER BY credits DESC LIMIT 10;
SELECT player.name, COUNT(player_id) AS amount FROM mystore_players AS player INNER JOIN mystore_items AS item ON player.id = item.player_id GROUP BY player.name ORDER BY amount DESC LIMIT 10;
SELECT player.name, SUM(item.price_of_purchase) AS worth, COUNT(item.price_of_purchase) AS amount FROM mystore_players AS player INNER JOIN mystore_items AS item ON player.id = item.player_id GROUP BY player.name ORDER BY worth DESC LIMIT 10;
SELECT player.name, (player.credits + SUM(item.price_of_purchase)) AS worth, COUNT(item.price_of_purchase) AS amount FROM mystore_players AS player INNER JOIN mystore_items AS item ON player.id = item.player_id GROUP BY player.name ORDER BY worth DESC LIMIT 10;