Page 1 of 1

[MVP] MVP Of the Round + Custom Sounds (reAPI Support)

Posted: Mon Nov 22, 2021 2:03 pm
by greenie
Most Valuable Player Of the Round


Informations
Description
Requirements
Installation
API
Credits
To Do List
Issues
ChangeLog
Downloads

Description
This script can detect the best killer or the planter ( if the bomb exploded ) or the defuser ( if the planted bomb is defused ), also it allows players to choose one of tracks uploaded by server owners ( Tracks can be for Privileged Users ( VIPs ) / Normal Players )
After the event is detected, it is showing a message in CHAT/ HUD / DHUD to all conected players.
Also, this script is supporting reHLDS's ReAPI, you can uncomment line 4 #define USE_REAPI to use ReAPI instead of HamSandwich and some events.

Requirements

AmxModX 1.8.2+
Hamsandwich module
ReAPI Module ( reHLDS Needed )
Installation
Download the archive from down below.
Compile most_valuable_player.sma using a local compiler or a web compiler which supports custom includes.
Put most_valuable_player.amxx in amxmodx/plugins folder
Go to amxmodx/configs/plugins.ini, open the file and write on the last line most_valuable_player.amxx.
Open MVPTracks.ini
Insert your database credentials ( optional )
Add your custom tracks ( optional )
Restart your server or change the map.
API

What mean API ? API is an abbreviation from Application Programming Interface and it's used to make external scripts which are for compatibility purpose.
INC File:
/* Sublime AMXX Editor v4.2 */

#if defined _most_valuable_player_included
#endinput
#endif
#define _most_valuable_player_included

#pragma reqlib most_valuable_player
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib most_valuable_player
#endif

enum WinScenario
{
NO_SCENARIO = -1,
TERO_MVP = 0,
CT_MVP,
KILLER_MVP_TERO,
KILLER_MVP_CT,
KILLER_MVP /* Just for default: case in PlayTrack(), unusable */
}

/**
* @description Multiforward called when a round end.
*
* @param scenario Scenario index. See WinScenario enum
* @return Scenario index.
*/
forward mvp_scenario(WinScenario:scenario);

/**
* Returns player's MVP kills.
*
* @param id Player index.
* @return Amount of kills. -1 on error.
*/
native get_user_mvp_kills(id);

/**
* Returns top killer's index.
*
* @param id Top killer index.
* @return Top killer's index. -1 on error.
*/
native get_user_mvp_topkiller(id);

/**
* Returns player's MVP damage.
*
* @param id Player index.
* @return Player index. -1 on error.
*/
native get_user_mvp_damage(id);

/**
* Returns player's MVP damage made with headshot.
*
* @param id Player index.
* @return Player index. -1 on error.
*/
native get_user_mvp_hs_damage(id);

/**
* Returns Player's MVPs.
*
* @param id Player index.
* @return Player index. -1 on error.
*/
native get_user_mvps(id);
Credits

OciXCrom for providing CromChat
Amxx-BG for providing API for ReAPI
Destro- for his Sublime AMXX-Editor
fysiks For providing help for code compilation through GitHub

ChangeLog
Version 1.0:
Initial Release


Version 1.3:
Added SoundTracks. Players can choose their own soundtrack.

Added SQL / nVault saving. This is used for remember each player's selected soundtrack.

Added HUD & DHUD message support.

Fixed a bug when no player were MVP, a empty message was shown.


Version 1.4:
Added SQLite Support.


Version 1.5:
Fixed a bug when no tracks were loaded from file.

Fixed a bug to tracklist handler.

Added Romanian Translation + a new entry in ML File.


Version 1.6:
Fixed multiple SQL connections.

Added Disable tracks option to saving / loading data.

Improved nVault save / load data.


Version 1.7:
Added the possibility to load / save data on Name or SteamID

Added the possibility to track player's MVPs.

Added a new native get_user_mvps() returning Player's MVPs.

Added a check for connected players.

Improved Load / Save checks against bots or hltv proxies.

Improved SQL Queries.

Less HardCoded SQL Queries.

Optimized Chat messages.

Fixed the Chat Prefix.


Version 1.8:
Added support for colored menus from Tracks Array

Cleaned and Improved pieces of code


Version 1.9:
Added a new feature: VIP Only Tracks

Fixed a bug reported in #42

Optimized code


Version 2.0:
Now name of the tracks are showing along with the MVP of the round

Added a check for ASCII alphabet character in FindCharPos() stock

Added a check for is_user_vip() stock if the flag is not an ASCII character

Optimized the code


Version 2.1:
Fixed a small bug when playing a track.

Implemented plugin compilation through GitHub. Thanks fysiks


Version 2.2:
Fixed a bug when displaying a message to all players using ML thanks lexzor

Implemented automatically connect to SqLite database if the MySQL database connection fails

Code style improvements


Version 2.3:
Multiple code improvements

Implemented support for AmxModX 1.8.2


Version 2.4:
Added full support for AmxModX 1.8.2

Improved PlayTrack() function

Fixed a bug in loading settings

Added support for changing name

Improved code

Thanks to HamletEagle


Version 2.5:
Fixed a bug when getting players from Terrorist team

Fixed detection when player is changing his name

Fixed a bug in showing menu ( it didn't show the MVP_VIP_ONLY in player's selected language

Fixed a bug in PlayTrack() function

Modified Load / Save Data code

Modified functions name


Version 2.6:
Fixed reading non-vips tracks even if they not exists

Inside plugin_precache, declared needed variables outside the while() loop

Fixed copying database credentials if not exists

Added a check for one or more missing data field in DataBase connection

Code style improvements

Added new natives: get_user_mvp_track(); get_mvp_track_info()
Downloads

github project
source
plugin