View Single Post
Author Message
Hallucinogenic Troll
Senior Member
Join Date: Apr 2015
Old 05-23-2018 , 18:49   [CS:S?/CS:GO ZR/ZP] Simple Rank System (V1.6, 08-07-2018)
Reply With Quote #1

[ZR/ZP] Simple Rank:

A simple rank system destined to Zombie Mod/Zombie Escape servers.
Since I didn't find a rank plugin with the specifics that I wanted, I decided to make one by myself.
It's still in beta, so it has a lot to go through (and it's my first plugin with databases).

Requirements:
Installation:
  1. Drag the file named zr_rank.smx to addons/sourcemod/plugins;
  2. Add the database in databases.cfg located in addons/sourcemod/configs, like this:
    Code:
    "zr_rank"
    {
      "driver"    "mysql"
      "host"      "YOUR_HOST_ADDRESS"
      "database"  "YOUR_DATABASE_NAME"
      "user"      "DATABASE_USERNAME"
      "pass"      "USERNAME_PASSWORD"
    }
  3. Restart the server;
  4. Edit the cvars as you like in, zr_rank.cfg, located in cfg/zr_rank;

ConVars:
  • zr_rank_startpoints (Default: 100) - Number of points that a new player starts;
  • zr_rank_infecthuman (Default: 1) - Number of points that you get when you infect an human (0 will disable it)
  • zr_rank_killzombie (Default: 1) - Number of points that you get when you kill a zombie (0 will disable it)
  • zr_rank_killzombie_headshot (Default: 2) - Number of points that you get when you kill a zombie with an headshot (0 will disable it);
  • zr_rank_killzombie_knife (Default: 5) - Number of points that you get when you kill a zombie with a knife (0 will disable it);
  • zr_rank_killzombie_he (Default: 3) - Number of points that you get when you kill a zombie with a He Grenade (0 will disable it);
  • zr_rank_killzombie_smokeflashbang (Default: 20) - Number of points that you get when you kill a zombie with a Smoke/Flashbang (0 will disable it);
  • zr_rank_stabzombie_left (Default: 1) - Number of points that you get when you stab a zombie with left mouse button (0 will disable it);
  • zr_rank_stabzombie_right (Default: 1) - Number of points that you get when you stab a zombie with right mouse button (0 will disable it);
  • zr_rank_maxplayers_top (Default: 50) - Max Max number of players that are shown in the top commands;
  • zr_rank_minplayers (Default: 4) - Minimum players for activating the rank system (0 will disable this function)
  • zr_rank_beinginfected (Default: 1) - How many points you lost if you got infected by a zombie
  • zr_rank_beingkilled (Default: 1) - How many points you lost if you get killed by an human
  • zr_rank_prefix (Default: [{purple}ZR Rank{default}]) - Changes every chat's plugin;
  • zr_rank_allow_warmup (Default: 0) - Allow players to get or lose points during warmup;
  • zr_rank_suicide (Default: 0) - How many points a player loses if he suicides;
  • zr_rank_roundwin_human (Default: 1) - How many points a player gets when he wins the round as an human;
  • zr_rank_roundwin_zombie (Default: 1) - How many points a player gets when he wins the round as a zombie;
Commands:
  • sm_rank - It shows your positions in the rank and your total points;
  • sm_top NUMBER - It shows the Top NUMBER players listed in the database, order by Points;
  • sm_topkills NUMBER - It shows the Top NUMBER players listed in the database, order by Zombies Killed;
  • sm_topinfects NUMBER - It shows the Top NUMBER players listed in the database, order by Humans Infected;
  • sm_humanwins NUMBER - It shows the Top NUMBER players listed in the database, order by Round Wins as an Human;
  • sm_zombiewins NUMBER - It shows the Top NUMBER players listed in the database, order by Round Wins as a Zombie;
  • sm_resetrank_all - It will reset all the players in the database (needs ROOT FLAG to have access);

API:
PHP Code:
/*********************************************************
 * Get's the number of a player's points
 *
 * @param client        The client to get the points
 * @return                The number of points        
 *********************************************************/
native int ZR_Rank_GetPoints(int client);

/*********************************************************
 * Sets points to a certain player
 *
 * @param client        The client to get the points
 * @param points        Number of points to set
 * @return                The number of points    
 *********************************************************/
native bool ZR_Rank_SetPoints(int clientint points);

/*********************************************************
 * Get's the number of a player's Zombie Kills
 *
 * @param client        The client to get the zombie kills
 * @return                The number of points        
 *********************************************************/
native int ZR_Rank_GetZombieKills(int client);

/*********************************************************
 * Get's the number of a player's Human Infects
 *
 * @param client        The client to get the zombie kills
 * @return                The number of points        
 *********************************************************/
native int ZR_Rank_GetHumanInfects(int client);

/*********************************************************
 * Get's the number of a player's Round Wins as Zombie
 *
 * @param client        The client to get the round wins
 * @return                The number of round wins        
 *********************************************************/
native int ZR_Rank_GetRoundWins_Zombie(int client);

/*********************************************************
 * Get's the number of a player's Round Wins as Human
 *
 * @param client        The client to get the round wins
 * @return                The number of round wins        
 *********************************************************/
native int ZR_Rank_GetRoundWins_Human(int client); 
WebPanels:Links:
To-Do List:
  • Translations - DONE;
  • Support for more than 10 players in the sm_top command - DONE;
  • Better checker for left and right mouse buttons when you stab a zombie;
  • Giving points when humans finish a map (and register the map's levels/stages);
  • A simple API for another sub-plugins Partially DONE;
  • A WebPage to show the rank of any player;
  • Optimize the code (A LOT);
  • Other suggestions given to me;

Changelog:
  • 1.0 - Plugin Release
  • View 1.1 Changelog
  • View 1.2 Changelog
  • View 1.3 Changelog
  • View 1.4 Changelog
  • View 1.5 Changelog
  • View 1.6 Changelog
__________________

Last edited by Hallucinogenic Troll; 09-21-2020 at 12:48. Reason: Updated GitHub Link
Hallucinogenic Troll is offline