** Info **
Everyone knows Alka's Played Time plugin. It doesn't really have many features, doesn't support SQL saving, and it only shows the top motd for online players only.
After seeing many requests about the motd, I decided to make a new plugin, which people will be able to switch between MySQL or nvault SQLite saving. Also I added new features which are described as I continue.
** New features **
Ability to switch easily between MySQL and nVault SQLite to save players times. (Changed from .sma file)
Top MOTD can show all saved players.
New command amx_show_player_times.
Added donate menu (separate plugin that uses the API). Players will be able to donate time to each other by just a chat command.
Added API for sub-plugins.
Ability to switch between colored chats or normals. Removed in lastest version. Only colored chat.
Added connect messages. (Can be disabled by a cvar)
Names and times are now saved by SteamIDs (or names in new version).
Name is updated on each name change.
Every second counts! Player won't lose any second of playing.
More features coming soon as I update the plugin. This is probably the last update.
** Admin commands **
Only one:
amx_show_player_time <name/@T/@CT/@TERR>
IF the command was written by it self, it will show all players played time, else it will show the written argument time
Example:
Code:
] amx_show_player_time
Showing players times of all connected players
1. Khalid 2510
2. Brandon 271
3. Solo[Pro] 41
....
] amx_show_player_time Khalid
Khalid's total played time is 592 minutes
] amx_show_player_time @T
Showing players times for team Terrorist
1. Khalid 251
2. BOT* NiceOne 243
...
** Client commands **
say\say_team * - Shows player time
say /top**_time - Shows top15 motd
say /top**time - same as above
* Can be one of these:
/mt, mt, mytime, /mytime, /my_time, my_time
** 1-∞ (maximized by the total entries)
** Cvars **
PHP Code:
pte_allow_donate "1" // Allow donating
pte_show_connect_messages "1" // Show messages upon connect
// These two cvars are only in the sub plugin "pte_donate_connect"
** Requirments **
To be able to use sqlite, you must enable it from modules.ini that is located in the configs folder.
This plugin supports AMXX versions 1.8.3 and 1.8.2; however, for 1.8.2 you will need a color chat include located HERE
** Editing **
Everything that can be edited easily is located on top of the plugin.
Spoiler
PHP Code:
/***** Stuff that you can Edit *****/
/* Explanation of stuff inside:
ADMIN_ACCESS_LETTER -> Access flag for the admin command that checks the time of a player
USE_NAME -> Will make the plugin use the name of the player as the saving identifier. If a player changes his name, his time will reset.
To disable: comment the line by adding // infront of #define
making it //#define
To Enable: Un comment the line by removing '//'
SAVE_TYPE -> Decides which method should the plugin use to save data:
Valid Values: 0 for SQLite (save locally in the server files), 1 for MySQL (must have an external server)
PREPARE_TOP_MOTD -> If you're using an external MySQL server (or if you have a huge amount of players, you might actually want to use this
This allows you to prepare the top motd as soon as the map starts instead of actually making it each time a player
submits a command; however, it does not give up to date results.
(TLDR: Good for servers with a huge load or amount of players,
does not give up to date results though, and will disable /top#_time command.)
Enable/Disable: Same method as USE_NAME
PREFIX -> The prefix of the chat messages. Should be easy to edit. Does not need any more explanation.
GET_TIME_INSTANT_QUERY ->
TOP_DEFAULT_NUMBER -> Number of entries in Top MOTD when using /toptime commands and if using PREPARE_TOP_MOTD
GET_TIME_INSTANT_QUERY -> This will force the plugin to not use threaded queries, only enable if you know what you're doing.
I do not recomment using this on distant servers (for example, your game server is in one end
while your sql server is at the other end of the world)
DO_NOT_LOG -> Do not let the plugin to log queries.
(Logging is useful for debuging, but if you don't want to, disable it by removing //)
PS: Do not expect support from me if you have logging disabled.
*/
new const g_szTopTimeChatCommands[][] = {
"/timetop",
"/time15",
"/toptime",
"/time10"
};
#if SAVE_TYPE == MYSQL
new const SQL_CONNECT_DATA[][] = {
"localhost",
"root",
"",
"amxx"
};
#endif
** Notes **
If you would like to reset all the saved data in the server (if you're using SQLite of course), follow the following steps:[LIST][*] Close your server[*] Go to cstrike/addons/amxmodx/data/sqlite3[*] Delete played_time_database.sq3[*] Re-open your server. The new empty database will be created again.
** Credits **
Alka - Original plugin idea.
Exolent[jNr] - For showing how to make a top motd with nvault_util Here - No longer used, but still thanks
Bugsy - For the nvault_util include - No longer used, but still thanks.
** Changelog **
Code:
v1.0b | 7th June 2016
* Fixed a situation where time time was reset because it was not retrieved and saved as 0.
* Added GET_TIME_INSTANT_QUERY
* Added DO_NOT_LOG
v1.0a | 5th June 2016
* Fixed compiling error for AMXX 1.8.2 compiler.
* A few fixes in the donate plugin
v1.0 | 2nd June 2016
* Rewritten plugin. Code should be better now and time resets should be fixed.
* Separated donation functionality and connect messages into other plugins.
* Changed natives names. Older plugins will still be able to run.
* Added two new forwards.
v0.1 | 27th Nov 2012 - Initial release.
PS: This code has nothing to do to Alka's plugin, I wrote this code from scratch, not just added new features to his plugin.
The sub-plugins require you to compile locally, if you don't know how, please, look here.
If there are any suggestions, improvments, bug fixes, etc, please post here.
Last edited by pokemonmaster; 06-07-2016 at 04:56.
Reason: Update 1.0b
This plugin is meant to show you an example on how to use plugin natives for creating other plugins that will be compatible with this.
Commands:
amx_set_time <name/@team/@all/*> <+/-/ or time to set> <time to add or take in minutes> - Sets time
Examples:
Code:
] amx_set_time
Usage: amx_set_time <name/@team/@all/*> <+/-/ or time to set> <time to add or take> - Sets time
] amx_set_time @T 100
ADMIN Khalid :): Set TERRORIST team players total time to 100
] amx_set_time @CT + 100
ADMIN Khalid :): Add to CT team players total time 100
] amx_set_time @ALL - 100000000
(IN CHAT) ADMIN Khalid :): Take from Everyone's total 2000
PS: To use this, you will need PlayedTime_Extended plugin from the first post and played_time.inc file
** Old plugins **
Old (unsupported plugins) are in the attachments, also.
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
Last edited by pokemonmaster; 06-07-2016 at 00:39.
Reason: update