Skip to content

mateus-bsod/samp-ranking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

samp-ranking

This project implements a simple and efficient ranking system, developed in Pawn, that maintains an ordered list of players based on their points. It uses local caching for fast access and MySQL for durable data persistence.

The system supports real-time notifications for online players and is configurable for different ranking sizes.

  • For the system to function correctly, it is necessary to include: MYSQL

Funções

Function Description
rank_create(const rank_name[]) Creates a new rank
rank_reset(const rank_name[]) Resets the rank data
rank_delete(const rank_name[]) Deletes a rank
rank_exists(const rank_name[]) Checks if a rank exists
rank_check(const rank_name[], const name[], points) Updates the rank with the player's points
rank_get(const rank_name[], const value_name[]) Gets the rank list for dialog display
rank_get_print(const rank_name[], const value_name[]) Gets the rank list to print in the console
set_rank_name_points(const rank_name[], id, const name[], points) Sets name and points in the rank
exists_name_rank(const rank_name[], const rank_player[]) Checks if a name exists in the rank
remove_name_rank(const rank_name[], const rank_player[]) Removes a name from the rank

Operation

  • It's not Bubble Sort. It's a simple and uncomplicated system, designed to NOT irritate the server's CPU (which is already weak).
  • No cache accumulation (mysql).
  • Clear and functional ranking insertion logic.
  • Notifies the player if they are online of the new position.
  • Uses a loop to shift existing ranks to maintain order.
  • Updates the database and cache synchronously.
  • One at a time, without the need for a system that works in chains simultaneously.

Player 500   Player 400
   |            |
   |         looping (repetir comparação)
   |            |
   |       player I > player II?  -> se sim, manter ordem
   |       player I < player II?  -> se sim, trocar ordem
   |
Resultado:
1. player II
2. player I

About

Ranking system for SA-MP (MySQL).

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages