System Updated
Added more options inside the .ini file to edit the system's features. Main settings:
[SQL CONFIG]
# SQL Connection settings
# Put here your SQL connection data for the rank system be able to
# save the data and load it everywhere.
SQL_HOST = 127.0.0.1
SQL_USER = root
SQL_PASS =
SQL_DB_NAME = ranksystem
[XP Settings]
# XP Settings
# Put here the ammount of XP of each event
DEFAULT_XP = 100
HEADSHOT_XP = 125
BOMB_PLANT_XP = 200
BOMB_DEFUSED_XP = 200
BOMB_EXPLOSION_XP = 200
ROUND_WIN_XP = 150
ACTIVITY_XP = 100
FLASH_ASSIST_XP = 50
ASSIST_XP = 50
KNIFE_KILL_XP = 85
BLIND_KILL_XP = 75
GRENADE_KILL_XP = 60
SUICIDE_XP = 50
MVP_XP = 400
[Settings]
# Misc settings for some events and bonus for players throughout the gameplay
# The main URL the system will load the files from
MAIN_URL =
# The .php postfix in case you want to have different top15 data
# without having to change the MAIN_URL
FILE_PREFIX =
# Assist toggle (Use 1 to activate and 0 to turn off)
ASSIST_TOGGLE = 1
# Number of frags players will receive when assisting
ASSIST_FRAGS = 1
# Active bonus check delay in seconds (default 10 minutes)
ACTIVE_DELAY = 600
# Number of min players necessary for statistics save
SQLSAVE_MIN_PLAYERS = 10
# Assist min damage
ASSIST_MIN_DAMAGE 40
# Spawn info hud toggle (Use 1 to activate and 0 to turn off)
SPAWN_HUD = 1
# Spawn Hud colors in RGB
SPAWN_HUD_COLOR = 200 80 30
# Spawn Hud position X and Y (horizontal and vertical)
SPAWN_HUD_POSITION = 0.02 0.15
# End of round MVP display toggle (Use 1 to activate and 0 to turn off).
MVP_HUD = 1
# End of round MVP display colors in RGB
MVP_HUD_COLOR = random random random
# End of round MVP display position X and Y (horizontal and vertical)
MVP_HUD_POSITION = -1.0 0.2
# XP bonus chat messages toggle (Use 1 to activate and 0 to turn off)
CHAT_INFO_MESSAGES = 1
# Level up sound directory
LEVEL_UP_SOUND = ranksystem/levelup.wav
# Level down sound directory
LEVEL_DOWN_SOUND = ranksystem/leveldown.wav
# Required flag access to have an Admin Color on the top15
PHP_ADMIN_FLAG = d
# Required flag access to have an VIP Color on the top15
PHP_VIP_FLAG = t
# Required flag access to have an Owner Color on the top15
PHP_OWNER_FLAG = a
# Menu Prefix on all menus
MENUS_TITLE = \rEFFEX Rank System\w
# ---------------------------------------------------
# ---------- RANK AND LEVELS CONFIGURATIONS ----------
# ---------------------------------------------------
[LEVEL LIST]
# Level List
# Manage here the name and the xp required for each level
# the last parameters CANNOT be changed.
"Newbie" "0" "za"
"Silver I" "5400" "zb"
"Silver II" "7200" "zc"
"Silver III" "8400" "zd"
"Silver IV" "12000" "ze"
"Silver V" "15600" "zf"
"Silver Elite" "19200" "zg"
"Gold Nova I" "30000" "zh"
"Gold Nova II" "48000" "zi"
"Gold Nova III" "84000" "zj"
"Gold Nova Master" "132000" "zk"
"Master Guardian I" "156000" "zl"
"Master Guardian II" "210000" "zm"
"Master Guardian Elite" "270000" "zn"
"DMG" "390000" "zo"
"Legendary Eagle" "510000" "zp"
"Legendary Eagle Master" "600000" "zq"
"Supreme" "2100000" "zr"
"The Global Elite" "3000000" "zs"
[RANK LIST]
# Manage here the name and the xp required for each rank
# the last parameters CANNOT be changed.
"Recruit" "0" "xa"
"Soldier I" "2400" "xb"
"Soldier II" "4800" "xc"
"Soldier III" "10800" "xd"
"Cape I" "14400" "xe"
"Cape II" "18000" "xf"
"Cape III" "21000" "xg"
"IV Cable" "24000" "xh"
"3rd Sergeant I" "30000" "xi"
"3rd Sergeant II" "33000" "xj"
"3rd Sergeant III" "39000" "xk"
"3rd Sergeant IV" "48000" "xl"
"2nd Sergeant I" "57000" "xm"
"2nd Sergeant II" "72000" "xn"
"2nd Sergeant III" "96000" "xo"
"2nd Sergeant IV" "132000" "xp"
"1st Sergeant I" "192000" "xq"
"1st Sergeant II" "246000" "xr"
"1st Sergeant III" "330000" "xs"
"1st Sergeant IV" "450000" "xu"
"Warrant Officer" "570000" "xv"
"Aspiring Officer I" "630000" "xw"
"Aspiring Officer II" "840000" "xx"
"Aspiring Officer III" "960000" "xy"
"Captain I" "1080000" "xz"
"Captain II" "1200000" "ya"
"Captain III" "1320000" "yb"
"Captain IV" "1440000" "yc"
"Major I" "1500000" "yd"
"Major II" "1560000" "ye"
"Major III" "1680000" "yf"
"Major IV" "1740000" "yg"
"Colonel I" "1800000" "yh"
"Colonel II" "1920000" "yi"
"Colonel III" "2040000" "yj"
"Brigadier General" "2160000" "yk"
"General Major" "2280000" "yl"
"Division General" "2400000" "ym"
"General" "2520000" "yn"
"General Global" "3000000" "yo"
Chat settings:
# Configuration tips for Tag Formats:
# FLAG = tags by flag
# example: FLAG = "c" "[Admin]" = tags with c flag
# -
# STEAM = tags by steam
# example: STEAM = "STEAM_" "[Admin]" = tags for steam
# IP = tags by ip
# example: IP = "IP" "[Admin]" = tags for ip
# NAME = tags by name
# example: NAME = "Name" "[Admin]" = tags for name
# ---------------------------- Tag Formats ------------------------------
FLAG = "a" "{green}[Owner]"
FLAG = "c" "{green}[Admin]"
FLAG = "t" "{green}[VIP]"
# ---------------------------- Default Formats ---------------------------------
# Avaliable custom tags to display on the chat:
# {kills}, {kd}, {headshots}, {levelname}, {level}, {rank}, {rankname}
#
# also, you can use {customtag} key to display your own custom tag
# make sure you use erank_set_customtag() native
# with the custom tag you want to display on chat.
SAY_ALLCHAT = 0
SAY_TEAM_ALLCHAT = 1
TERRORIST = "(Terrorists)"
COUNTER-TERRORIST = "(Counter-Terrorists)"
FORMAT_MESSAGE_PLAYER = "{tag} {green}[+{kills}] {team-color}{name}: {normal}{message}"
FORMAT_MESSAGE_PLAYER_DEAD = "{normal}*DEAD* {green}[+{kills}] {team-color}{name}: {normal}{message}"
FORMAT_MESSAGE_PLAYER_TEAM = "{normal}{team} {green}[+{kills}] {team-color}{name}: {normal}{message}"
FORMAT_MESSAGE_PLAYER_TEAM_DEAD = "{team} {normal}*DEAD* {tag} {green}[+{kills}] {team-color}{name}: {normal}{message}"
FORMAT_MESSAGE_ADMIN = "{tag} {green}[+{kills}] {team-color}{name}: {green}{message}"
FORMAT_MESSAGE_ADMIN_DEAD = "{normal}*DEAD* {green}[+{kills}] {tag} {team-color}{name}: {green}{message}"
FORMAT_MESSAGE_ADMIN_TEAM = "{normal}{team} {green}[+{kills}] {tag} {team-color}{name}: {green}{message}"
FORMAT_MESSAGE_ADMIN_TEAM_DEAD = "{normal}{team} {normal}*DEAD* {green}[+{kills}] {tag} {team-color}{name}: {green}{message}"
There are natives avaliable for users to communicate with the system as well:
/* Gets the user's rank position
* @id the user's identification
*/
native erank_get_position(id)
/* Gets the user's level number
* @id the user's identification
*/
native erank_get_level(id)
/* Gets the user's rank number
* @id the user's identification
*/
native erank_get_rank(id)
/* Gets the user's XP ammount
* @id the user's identification
*/
native erank_get_userxp(id)
/* Completely reset user's data
* @id the user's identification
*/
native erank_reset_user_data(id)
/* Returns the user's current level name
* @id the user's identification
* @szLevelName the string that will be formated
* @iLen string's length
*/
native erank_get_levelname(id, szLevelName[], iLen)
/* Returns the user's current rank name
* @id the user's identification
* @szRankName the string that will be formated
* @iLen string's length
*/
native erank_get_rankname(id, szRankName[], iLen)
/* Get a specified user's data
* @id the user's identification
* @iUserData specified data to get info from
*/
native erank_get_userdata(id, pPlayerData:iUserData)
/* Set a specified user's data
* @id the user's identification
* @iUserData specified data to get info from
* @iValue value
*/
native erank_set_userdata(id, pPlayerData:iUserData, iValue)
/* Sets the user's XP ammount
* @id the user's identification
* @iXpAmmount ammount of XP
*/
native erank_set_userxp(id, iXpAmmount)
/* Sets a custom tag property for players
* @id the user's identification
* @szCustomTag custom tag string
*/
native erank_set_customtag(id, szCustomTag[])
Avaliable commands to use on the system:
erank_alter_column = <column name> <condition> <value> - change column values
erank_delete_column = <column name> - delete a column
erank_create_column = <column name> <varchar or int> <num> - create a new column
erank_give_player_xp = <name> <XP ammount (use negative values to take from or 0 to reset)> <automatically calculates kills and deaths based on the XP added (1|0)>
erank_reset_prefixes = the name explain's itself.
Simple example on how to use the natives by giving a certain flag to users depending of their's rank position:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <effex_ranksystem>
#define PLUGIN "EFFEX Rank system: Flags"
#define VERSION "1.0"
#define AUTHOR "author"
enum arData
{
szRequiredLevel[5],
szFlag[32]
}
new Array:g_arIniFlags
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "playerSpawn", 1)
g_arIniFlags = ArrayCreate(arData)
readIniFile()
}
public playerSpawn(id)
{
for(new i, arrayData[arData];i < ArraySize(g_arIniFlags);i++)
{
ArrayGetArray(g_arIniFlags, i, arrayData)
if(erank_get_level(id) >= str_to_num(arrayData[szRequiredLevel]))
{
set_user_flags(id, read_flags(arrayData[szFlag]))
remove_user_flags(id, read_flags("z"))
}
}
}
readIniFile()
{
new szConfigsName[256],szFilename[256];
get_configsdir(szConfigsName, 255);
formatex(szFilename, charsmax(szFilename), "%s/erank_flags.ini", szConfigsName);
new iFile = fopen(szFilename, "r")
if(!iFile)
{
new szFmt[100]
formatex(szFmt, charsmax(szFmt), "Archive ^"%s^" does not exist!", szFilename)
set_fail_state(szFmt)
}
while (!feof(iFile))
{
new szBuffer[512], szKey[5], szValue[32], arrayData[arData]
fgets(iFile, szBuffer, charsmax(szBuffer))
trim(szBuffer)
if(szBuffer[0] == EOS || szBuffer[0] == ';' || szBuffer[0] == '#' || (szBuffer[0] == '/' && szBuffer[1] == '/'))
continue
strtok(szBuffer, szKey, charsmax(szKey), szValue, charsmax(szValue), '=')
trim(szKey)
trim(szValue)
copy(arrayData[szRequiredLevel], charsmax(arrayData[szRequiredLevel]), szKey)
copy(arrayData[szFlag], charsmax(arrayData[szFlag]), szValue)
ArrayPushArray(g_arIniFlags, arrayData)
}
fclose(iFile)
}
Another example by giving T flag (normally used for VIPS) for top3 players:
#include <amxmodx>
#include <hamsandwich>
#include <effex_ranksystem>
#define PLUGIN "EFFEX Rank system: Top3 VIP"
#define VERSION "1.0"
#define AUTHOR "author"
#define REQUIRED_FLAG ADMIN_LEVEL_H
const MIN_POSITION = 3
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "playerSpawn", 1)
}
public playerSpawn(id)
{
if((erank_get_position(id) >= MIN_POSITION) && !(get_user_flags(id) & REQUIRED_FLAG))
{
set_user_flags(id, REQUIRED_FLAG)
remove_user_flags(id, read_flags("z"))
}
}
Ty.