Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Simple plugin to award first TOP players in stats by bonus flags
- * Players already having all bonus flags or having IGNORE_FLAG (disabled by default) are ignored.
- * An awarded player gets informed by color chat.
- *
- * Last update:
- * 9/24/2016
- *
- * Support forum:
- * https://goldsrc.ru/
- *
- * Changes:
- * - rewritten from scratch; all options are set in the source now
- * - plugin uses data from stats plugins by SKAJIbnEJIb
- * - added external colorchat support (native for AMXX 1.8.3, stock for earlier versions)
- * you could download stock here: http://aghl.ru/forum/viewtopic.php?p=21539#p21539
- *
- * Credits:
- * - original plugin's authors SimonLogic & RoleX
- * - c-s.net.ua users 3aB}{o3 & cs-portal for the idea and link
- *
- * Notes:
- * - it is transitional version, I hope there will be all-in-one version soon
- * - 'cs' in version means 'chat version, SKAJIbnEJIb edition'
- */
- /* Copyright 2016 Safety1st
- Top Awards is free software;
- you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- - 22.10.2016
- wopox1337: добавил dhud сообщение
- */
- #include <amxmodx>
- #include <csstats_mysql>
- #define PLUGIN "Top Awards"
- #define VERSION "0.2 Csstats_RBS"
- #define AUTHOR "Safety1st"
- /*----------------------------------EDIT ME----------------------------------*/
- const TOP_MAX = 10 // how many first TOP players will be given bonus flags
- const ADD_FLAGS = ADMIN_LEVEL_H | ADMIN_LEVEL_A // which flags we will add as a bonus; flag 't' by default
- // #define IGNORE_FLAG ADMIN_LEVEL_A // which players will not have bonus flags; uncomment to enable; flag 'm' by default
- /*-------------------------------STOP EDIT HERE-------------------------------*/
- #if AMXX_VERSION_NUM < 183
- // AMXX 1.8.3-dev since hg185 has its own colorchat support
- #include <colorchat>
- #define print_team_default DontChange
- #define print_team_grey Grey
- #define print_team_red Red
- #define print_team_blue Blue
- #include <dhudmessage>
- #endif
- #define TASK_DELAY 5.0 // Задержка при показе сообщения о получении TOP привелгеий
- public plugin_init() {
- register_plugin( PLUGIN, VERSION, AUTHOR )
- register_dictionary( "top_awards.txt" )
- }
- public csstats_putinserver( id, bool:wasbefore ) {
- // forward is called when stats is loaded for entered player
- if( !wasbefore )
- // a new player
- return
- if( is_user_bot(id) || is_user_hltv(id) )
- // dunno whether it is still needed...
- return
- new iFlags = get_user_flags(id)
- if ( iFlags & ADD_FLAGS == ADD_FLAGS )
- // ignore player having all additional flags
- return
- #if defined IGNORE_FLAG
- if ( iFlags & IGNORE_FLAG )
- return
- #endif
- new iRank = csstats_get_user_place(id)
- if ( iRank && iRank <= TOP_MAX ) {
- // 1st check for safety. may be player not ranked at all yet
- set_user_flags( id, ADD_FLAGS ) // function adds the flags using a bitwise-or operation
- set_task( TASK_DELAY, "PrintMessage", id )
- }
- }
- public PrintMessage(id) {
- if ( !is_user_connected(id) )
- return
- // Сообщение в чат
- client_print_color( id, print_team_default, "%L", id, "TOP_AWARDS", TOP_MAX )
- // Сообщение в DHUD
- set_dhudmessage( random(200) + 25, random(200) + 25, random(200) + 25, -1.0, 0.35, .holdtime = 12.0 )
- show_dhudmessage( id, "%L", id, "TOP_AWARDS", TOP_MAX)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement