Introduction
This is the first time I post a plugin in alliedmodders.
The plugin basically gives you skillpoints for when you kill, plant, disarm or when your team wins the round. These points are stored in a database within the server and all SkillPoints are customizable by cvars.
Commands
- /myskill – Shows your skillpoints in the server chat.
- /restartskill - Restart your skillpoints and level
- /rankskill - Show your current rank
- /topskill- Show the Top15 players with the highest SkillPoints
Admin Commands
- bps_give <target> <skillpoints to give>
- bps_take <target> <skillpoints to take>
CVARS
Code:
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// SkillPoints Configuration //////////////////////////////////
bps_ads 1 // Turn on/off the commands announcements in the chat
bps_time_between_ads 300.0 // Time between adds (in seconds)
bps_announce_on_chat 1 // Turn on/off the announcements in the chat when you win/lose points
bps_skillpoints_on_nick 1 // Turn on/off SkillPoints in nickname ex: (nick <1337>) (updates when player spawn)
bps_hide_change_nick_notification 1 // Hide change nick announcement
bps_skillpoints_cmd 1 // Turn on/off /myskill command
bps_skillpoints_cmd_restart 1 // Turn on/off /restartskill command
bps_skillpoints_cmd_rank 1 // Turn on/off /rankskill command
bps_skillpoints_cmd_top15 1 // Turn on/off /topskill command
bps_hide_cmd 0 // Hide the commands
bps_enable_win_per_hour 1 // Turn on/off hourly points
bps_won_points_hour 5 // Points awarded for playing more than 1hour
bps_lost_points_tk 5 // Points lost for TeamKilling
bps_lost_points_suicide 1 // Points lost for suicide
bps_won_points_kill 1 // Points awarded per kill
bps_lost_points_kill 1 // Points lost per death
bps_won_points_headshot 2 // Points awarded per headshot
bps_lost_points_headshot 2 // Points lost for dying with an headshot
bps_won_points_knife 3 // Points awarded per knife kill
bps_lost_points_knife 3 // Points lost for dying with knife
bps_won_points_grenade 3 // Points awarded per HE kill
bps_lost_points_grenade 3 // Points lost for dying with an HE
bps_won_points_ts 1 // Points awarded to Terrorist Team for winning the round
bps_won_points_cts 1 // Points awarded to Counter-Terrorist Team for winning the round
bps_lost_points_ts 1 // Points lost to Terrorist Team for losing the round
bps_lost_points_cts // 1 Poits lost to Counter-Terrorist Team for losing the round
bps_won_points_planter 1 // Points awarded for planting the bomb
bps_won_points_planter_explode 2 // Points awarded for bomb successfully exploding
bps_won_points_defuser 3 // Points awarded for successfully disarming the bomb
bps_won_points_4k 4 // Points awarded for killing 4 in a round (almost)
bps_won_points_5k 5 // Points awarded for killing 5 (or more) in a round (ace)
bps_negative_points 0 // Turn on/off negative skillpoints
bps_sql_host "" // Host (SQL ONLY)
bps_sql_user "" / Username of the database (SQL ONLY)
bps_sql_pass "" // Password of the database (SQL ONLY)
bps_sql_db "" // Name of the database (SQL ONLY)
/////////////////////////////////////////////////////////////////////////////////////////////////
Requirements
FVault version
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < csx >
#include < hamsandwich >
#include < fvault >
SQL version
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < csx >
#include < hamsandwich >
#include < sqlx >
IMPORTANT
Requires amx mod x 1.8.1 or higher
Defines
FVault version
PHP Code:
#define MAX_PLAYERS 32
#define ADMIN ADMIN_RCON
#define EXPIREDAYS 30
#define MAX_CLASSES 5
#define MAX_LEVELS 5
#define MAX_PONTUATION 10000 // max skillpoints per player
SQL version
PHP Code:
#define MAX_PLAYERS 32
#define ADMIN ADMIN_RCON
#define CONNECT_TASK 1024
#define MAX_CLASSES 5
#define MAX_LEVELS 5
#define MAX_PONTUATION 10000 // max skillpoints per player
Levels
(This is just a reference, change at your own way)
SkillPoints < 500 Level: BOT
500 <= SkillPoints < 1200 Level: NOOB
1200 <= SkillPoints < 1800 Level: GAMER
1800 <= SkillPoints < 2500 Level: LEET
SkillPoints >= 2500 Level: TOP
PHP Code:
new const CLASSES[ MAXCLASSES ][ ] = {
"BOT",
"NOOB",
"GAMER",
"LEET",
"TOP"
}
new const LEVELS[ MAXLEVELS ] = {
500,
1200,
1800,
2500,
100000 /* high value (not reachable) */
}
API
PHP Code:
#pragma reqlib "skillpoints"
/**
* Returns the number of SkillPoints
*
* @param id - Index of the player
*/
native skillpoints( id )
Simple example,
PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < skillpoints >
public plugin_init( )
{
register_plugin( "Test skillpoints.inc", "1.0.0", "guipatinador" )
RegisterHam( Ham_Spawn, "player", "Fwd_PlayerSpawnPost", 1 )
}
public Fwd_PlayerSpawnPost( id )
{
if( is_user_alive( id ) )
{
if( skillpoints( id ) > 0 )
{
client_print( id, print_chat, "WOW, you have positive SkillPoints!" )
}
}
}
Instalation
FVault version
1.
Download and
unzip the attached file
2. Find
BasicSkillPointsFVault_SE.sma and compile it.
3. Copy
BasicSkillPointsFVault_SE.amxx to the
cstrike/addons/amxmodx/plugins folder
4. Add
BasicSkillPointsFVault_SE.amxx to your
plugins.ini file
5. Copy the cvars to your
server.cfg and customize at your own way
6. Change map or restart your server
SQL version
1.
Download and
unzip the attached file
2. Find
BasicSkillPointsSQL_SE.sma and compile it.
3. Copy
BasicSkillPointsSQL_SE.amxx to the
cstrike/addons/amxmodx/plugins folder
4. Add
BasicSkillPointsSQL_SE.amxx to your
plugins.ini file
5. Copy the cvars to your
server.cfg and customize at your own way
6. Open
index.php
PHP Code:
// database connection
$sql_ip = "localhost";
$sql_user = "mysql_user";
$sql_password = "mysql_password";
$sql_database = "database_name";
6. Modify this, save and close
7. Upload
index.php and
style.css to your web server
8. Change map or restart your server
Useful tutorial:
[HOWTO] Compile locally with custom includes
To-Do List
-
Bugs
- When a player loses a lot of points, his level doesn't downgrade
- When a player die with the bomb explosion, he lost 1 point (for suicide)
- When you start the server for the first time, the plugin is forced to stop, with the following error,
Code:
L 02/23/2013 - 20:27:27: Start of error session.
L 02/23/2013 - 20:27:27: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20130223.log")
L 02/23/2013 - 20:27:27: [AMXX] Plugin ("BasicSkillPointsSQL.amxx") is setting itself as failed.
L 02/23/2013 - 20:27:27: [AMXX] Plugin says: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
L 02/23/2013 - 20:27:27: [AMXX] Run time error 1 (plugin "BasicSkillPointsSQL.amxx") - forced exit
Just change your map and it will be ok.
Changelog
Code:
v2.0.2 (18/04/2014) FVault & SQL SPECIAL EDITION
- Some parts of the code were rewritten, requested by hornet
v2.0.1 (06/04/2014) FVault & SQL SPECIAL EDITION
- Max size of array changed (192 -> 190) to prevent server crash
v2.0.0 (28/03/2013) FVault & SQL SPECIAL EDITION
- Inclusion of Kills, Deaths, HeadShots, Knife Kills / Deaths, Grenade Kills / Deaths, Bomb Explosions, Defused Bombs and Won Rounds
- Top15 restructured (JumpStats style)
v1.2.0 (27/03/2013) FVault & SQL
- Code improvements
v1.1.9 (04/03/2013) FVault & SQL
- award for killing 4 (almost) ou 5 (ace) in a round
v1.1.8 (04/03/2013) FVault
- Top15 to the FVault version
- Fixed a bug in the rank command
v1.1.7 (23/02/2013) FVault & SQL
- Add a rank to the FVault version
- Fixed a bug in bps_give and bps_take
- Add an advertisement to /topskill command
v1.1.6 (23/02/2013) FVault & SQL
- Add a Top15 for the SQL version (like the original /top15 of statsx)
- Fixed a cvar name
v1.1.5 (23/02/2013) FVault & SQL
- a lot of things were changed
v1.1.4 (29/08/2012) nVault & SQL
- When T/CT loose the round, they lose points (added 2 cvars for that)
- Points are saved at the end of the round with a delay of 0.5 sec
- Now players can win points if they kill BOT's
v1.1.3 (22/08/2012) nvault & SQL
- Now points are saved when a player spawn / disconnect
- Important fix when the plugin load the points (SQL version)
v1.1.2 (19/08/2012) nVault & SQL
- Bug fixed when a player connect / disconnect
- Fixed SQL Injection
v1.1.1 (19/08/2012) SQL
- Now /rankskill works faster !!!
v1.1.0 (19/08/2012) SQL
- Add an advertisement to /rankskill command
v1.0.9 (19/08/2012) SQL
- Add SQL
- Add rank system
- In SQL version points are saved in the end of the round
v1.0.8 (11/08/2012) nVault
- Fixed bug when you give/take points. -> This is not fixed yet
- Fixed string size
v1.0.7 (08/08/2012) nVault
- Add #define EXPIREDAYS 30
v1.0.6 (05/08/2012) nVault
- Fixed skillpoints when CT's win the round
- Code optimized
v1.0.5 (04/08/2012) nVault
- Add the code of ColorChat Stock to the .sma. Now you don't need to compile locally
v1.0.4 (03/08/2012) nVault
- Add API
v1.0.3 (03/08/2012) nVault
- Now SkillPoints in nickname updates at the player spawn (instead of new round)
v1.0.2 (02/08/2012) nVault
- Add /restartskill for restart SkillPoints and level
- Add bps_give and bps_take (admin only)
v1.0.1 (02/08/2012) nVault
- Fixed skillpoints when you die with a headshot
v1.0.0 (01/082012) nVault
- Initial release
Credits
- ramais and FallenAngel for translating to English
- ramais for the php script
- fysiks - SkillPoints in nickname -
http://forums.alliedmods.net/showpos...47&postcount=4
- Exolent[jNr] - Hide change nick notification -
https://forums.alliedmods.net/showpo...5&postcount=23
- ConnorMcLeod - cs_get_user_team
http://forums.alliedmods.net/showthread.php?t=191400
- ConnorMcLeod - ColorChat Stock
http://forums.alliedmods.net/showpos...2&postcount=90
- Exolent[jNr] - JumpStats MOTD
Screenshots