Нужно заблочить rtv |
Здравствуйте, гость Вход | Регистрация
Наши новости:
|
|
|
Нужно заблочить rtv |
Akushi
|
6.9.2011, 9:46
Сообщение
|
![]() |
Стоит Ufps Map Manager + rtv
/* Nextmap Chooser Интегрированы: Lastround & RockTheVote Использован код следующих плагинов, за что их авторам большая благодарность: 1. Nextmap Chooser Plugin by the AMX Mod X Development Team originally developed by OLO 2. RockTheVote v1.8 Made by DA Переменные: amx_extendmap_max (default: 45) - Максимальная длительность карты в минутах amx_extendmap_step (default: 15) - Время продления карты за 1 раз в минутах amx_vote_time (default: 15) - Длительность голосования в секундах amx_vote_delay (default: 3) - Отсрочка голосования в минутах от начала карты amx_votemap_ratio (default: 0.6) - Процент голосов для начала голосования (по-умолчанию 60%) amx_lastround (default: 1) - Производить смену карты по окончании раунда. Rebuilding by UFPS.Team */ #include <amxmodx> #include <amxmisc> #define PLUGIN_NAME "Nextmap Chooser" #define PLUGIN_VERSION "1.9" #define PLUGIN_AUTHOR "UFPS.Team" #define SELECTMAPS 5 #define MAPS_MAX 128 #define AUTO_LANG -76 #define charsmax(%1) (sizeof(%1)-1) new g_mapNums new g_mapName [MAPS_MAX [32] new g_nextName [SELECTMAPS] new g_voteCount [SELECTMAPS + 2] new g_mapVoteNum new g_teamScore [2] new g_lastMap [32] new g_rtv_count new g_rtv_vote [33] new g_MENU [512] new g_MENU_keys = ( 1 << SELECTMAPS + 1 ) new g_MENU_name [64] new g_MENU_title [128] new const speak[][] = { "one", "two", "three", "four", "five" } new g_coloredMenus = 0 new bool:g_rtv = false new bool:g_lastround = false new bool:g_changemap = false new bool:g_selected = false new Float:g_timelimit = 0.0 new pcv_lastround new pcv_extendmap_max new pcv_extendmap_step new pcv_vote_time new pcv_vote_delay new pcv_votemap_ratio new pcv_amx_nextmap new pcv_mp_chattime new pcv_mp_timelimit new pcv_mp_winlimit new pcv_mp_maxrounds public plugin_init( ) { register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR ) register_dictionary ( "common.txt" ) register_dictionary ( "lastround.txt" ) register_dictionary ( "mapchooser.txt" ) register_clcmd( "say rockthevote", "cmd_say_rtv" ) register_clcmd( "say /rockthevote", "cmd_say_rtv" ) register_clcmd( "say rtv", "cmd_say_rtv" ) register_clcmd( "say /rtv", "cmd_say_rtv" ) register_clcmd( "say_team rockthevote", "cmd_say_rtv" ) register_clcmd( "say_team /rockthevote", "cmd_say_rtv" ) register_clcmd( "say_team rtv", "cmd_say_rtv" ) register_clcmd( "say_team /rtv", "cmd_say_rtv" ) pcv_vote_time = pcvar_register( "amx_vote_time", "15" ) pcv_vote_delay = pcvar_register( "amx_vote_delay", "3" ) pcv_votemap_ratio = pcvar_register( "amx_votemap_ratio", "0.60" ) pcv_extendmap_max = pcvar_register( "amx_extendmap_max", "45" ) pcv_extendmap_step = pcvar_register( "amx_extendmap_step", "15" ) pcv_mp_chattime = get_cvar_pointer( "mp_chattime" ) pcv_mp_timelimit = get_cvar_pointer( "mp_timelimit" ) pcv_mp_winlimit = get_cvar_pointer( "mp_winlimit" ) pcv_mp_maxrounds = get_cvar_pointer( "mp_maxrounds" ) pcv_amx_nextmap = get_cvar_pointer( "amx_nextmap" ) if( !pcv_amx_nextmap ) pcv_amx_nextmap = register_cvar( "amx_nextmap", "", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_SPONLY ) if( cstrike_running( ) ) { pcv_lastround = register_cvar( "amx_lastround", "1" ) register_event( "TeamScore", "team_score", "a" ) register_logevent( "evRoundStart", 2, "0=World triggered", "1=Round_Start" ) } register_event( "30", "mapChange", "a" ) g_coloredMenus = colored_menus( ) get_localinfo( "lastMap", g_lastMap, charsmax( g_lastMap ) ) set_localinfo( "lastMap", "" ) set_cvar_float( "sv_restart", 1.0 ) } public plugin_cfg( ) { new mapcycle[64] get_configsdir( mapcycle, charsmax( mapcycle ) ) format( mapcycle, charsmax( mapcycle ), "%s/maps.ini", mapcycle ) if( !file_exists( mapcycle ) ) get_cvar_string( "mapcyclefile", mapcycle, charsmax( mapcycle ) ) if( !file_exists( mapcycle ) ) copy( mapcycle, charsmax( mapcycle ), "mapcycle.txt" ) if( loadSettings( mapcycle) ) set_task( 15.0, "voteNextmap", 987456, "", 0, "b" ) formatex( g_MENU_name, charsmax( g_MENU_name ), "%L", "en", "CHOOSE_NEXTM" ) register_menucmd( register_menuid( g_MENU_name ), ( -1 ^ ( -1 << ( SELECTMAPS + 2 ) ) ), "countVote" ) } public countVote( id, key ) { if( get_cvar_float( "amx_vote_answers" ) ) { new name[32] get_user_name( id, name, charsmax( name ) ) if( key == SELECTMAPS ) client_print( 0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name ) else if( key < SELECTMAPS ) { new map[32] copy( map, charsmax( map ), g_mapName[g_nextName[key]] ) client_print( 0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, map ) } } g_voteCount[key]++ return PLUGIN_HANDLED } public voteNextmap( ) { if( !g_mapNums ) return 0 new winlimit = get_pcvar_num( pcv_mp_winlimit ) new maxrounds = get_pcvar_num( pcv_mp_maxrounds ) if( g_rtv ) { winlimit = 0 maxrounds = -1 } if( winlimit ) { new c = winlimit - 2 if( ( c > g_teamScore[0] ) && ( c > g_teamScore[1] ) ) { g_selected = false return 0 } } else if( maxrounds ) { if( ( maxrounds - 2 ) > ( g_teamScore[0] + g_teamScore[1] ) ) { g_selected = false return 0 } } else { new timeleft = get_timeleft( ) if( timeleft < 1 || timeleft > 129 ) { g_selected = false return 0 } } if( g_selected ) return 0 g_selected = true new pos, a g_MENU_keys = ( 1 << SELECTMAPS + 1 ) new dmax = clamp( g_mapNums, 0, SELECTMAPS ) for( g_mapVoteNum = 0; g_mapVoteNum < dmax; g_mapVoteNum++ ) { a = random_num( 0, g_mapNums - 1 ) while( isInMenu( a ) ) { if( ++a >= g_mapNums ) a = 0; } g_nextName[g_mapVoteNum] = a pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %s^n", g_mapVoteNum + 1, g_mapName[a] ) g_MENU_keys |= ( 1 << g_mapVoteNum ) g_voteCount[g_mapVoteNum] = 0 } g_MENU[pos++] = '^n' g_voteCount[SELECTMAPS] = 0 g_voteCount[SELECTMAPS + 1] = 0 new mapname[32] get_mapname( mapname, charsmax( mapname ) ) if( ( winlimit + maxrounds ) == 0 && ( get_pcvar_float( pcv_mp_timelimit ) < get_pcvar_float( pcv_extendmap_max ) ) ) { pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname ) g_MENU_keys |= ( 1 << SELECTMAPS ) } format( g_MENU[pos], charsmax( g_MENU ), "%d. %L", SELECTMAPS + 2, LANG_SERVER, "NONE" ) set_task( 1.0, "countDown", 5 ) return 1 } stock bool:isInMenu( id ) { for( new a; a < g_mapVoteNum; a++ ) if( id == g_nextName[a] ) return true return false } public countDown( timer ) { if( timer ) { client_cmd( 0 ,"spk ^"fvox/%s^"", speak[timer-1] ) say_hudmessage( 0, 64, 64, 64, 0.025, -1.0, 0, 0.0, 1.03, 0.0, 0.0, 4, "%L %L", AUTO_LANG, "CHOOSE_NEXTM", AUTO_LANG, "VOTE_COUNTER", timer, g_MENU ) set_task(1.0, "countDown", --timer) } else set_task( 0.01, "showMenu" ) } public showMenu( ) { new Float:votetime = floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 ) new menu[512], players[32], player, num get_players( players, num, "ch" ) for( new i; i < num; i++ ) { player = players[i] formatex( g_MENU_title, charsmax( g_MENU_title ), g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", player, "CHOOSE_NEXTM" ) formatex( menu, charsmax( menu ), "%s%s", g_MENU_title, g_MENU ) show_menu( player, g_MENU_keys, menu, floatround( votetime ), g_MENU_name ) } set_task( votetime + 0.5, "checkVotes" ) client_print( 0, print_chat, "%L", LANG_PLAYER, "TIME_CHOOSE" ) client_cmd( 0, "spk Gman/Gman_Choose%d", random_num( 1, 2 ) ) log_amx( "Vote: Voting for the nextmap started" ) } public checkVotes( ) { new b = 0 for( new a; a < g_mapVoteNum; ++a ) if( g_voteCount[b] < g_voteCount[a] ) b = a if( g_voteCount[SELECTMAPS] > g_voteCount[b] && g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS + 1] ) { if( !g_timelimit ) g_timelimit = get_pcvar_float( pcv_mp_timelimit ) new Float:steptime = get_pcvar_float( pcv_extendmap_step ) new mapname[32] get_mapname( mapname, charsmax( mapname ) ) set_pcvar_float( pcv_mp_timelimit, get_pcvar_float( pcv_mp_timelimit ) + steptime ) client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime ) log_amx( "Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime ) return } new smap[32] if( g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b] ) { copy( smap, charsmax( smap ), g_mapName[g_nextName[b]] ) set_pcvar_string( pcv_amx_nextmap, smap ) } get_pcvar_string( pcv_amx_nextmap, smap, charsmax( smap ) ) client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap ) log_amx( "Vote: Voting for the nextmap finished. The nextmap will be %s", smap ) new players[32], num get_players( players, num, "ch" ) if( g_rtv ) { if( pcv_lastround && get_pcvar_num( pcv_lastround ) ) { if( !g_timelimit ) g_timelimit = get_pcvar_float( pcv_mp_timelimit ) set_pcvar_float( pcv_mp_timelimit, 0.0 ) g_rtv = false g_changemap = true g_lastround = false say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" ) return } else g_rtv = false } else if( num > 1 ) { if( pcv_lastround ) { set_task( 90.0 - floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 ), "initiateLastRound", 23478, "", 0, "d" ) return } } set_task( 1.0, "delayMapChange" ) } public initiateLastRound( ) { if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE if( !g_timelimit ) g_timelimit = get_pcvar_float( pcv_mp_timelimit ) g_lastround = true set_pcvar_float( pcv_mp_timelimit, 0.0 ) say_hudmessage( 0, 100, 200, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_COMING" ) return PLUGIN_CONTINUE } public evRoundStart( ) { if( !pcv_lastround ) return PLUGIN_CONTINUE if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE if( g_lastround ) { g_changemap = true g_lastround = false say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" ) } else if( g_changemap ) { /* message_begin ( MSG_ALL, SVC_INTERMISSION ) message_end ( ) */ set_pcvar_float( pcv_mp_timelimit, 0.01 ) } return PLUGIN_CONTINUE } public mapChange ( ) { new Float:chattime = get_pcvar_float ( pcv_mp_chattime ) if ( chattime < 3.0 ) { chattime = 3.0 set_pcvar_float ( pcv_mp_chattime, chattime ) } set_task( chattime - 1.0, "delayMapChange" ) return PLUGIN_CONTINUE } public delayMapChange( ) { new nextmap[32] get_pcvar_string( pcv_amx_nextmap, nextmap, charsmax( nextmap ) ) server_cmd( "changelevel %s", nextmap ) } loadSettings( filename[] ) { if( !file_exists( filename ) ) { log_amx( "Mapcycle file ^"%s^" not found", filename ) return 0 } g_mapNums = 0 new currentMap[32], map[32], string[256] get_mapname( currentMap, charsmax( currentMap ) ) new file = fopen( filename, "r" ) while( !feof( file ) ) { fgets( file, string, charsmax( string ) ) if ( ( string[0] != ';' ) && ( string[0] != '/' ) && parse( string, map, charsmax( map ) ) && isValidMap( map, charsmax( map ), currentMap ) && isMapCycle( map ) == -1 ) { copy( g_mapName[g_mapNums++], charsmax( g_mapName[] ), map ) } } fclose( file ) return g_mapNums } stock bool:isValidMap( map[], const len, const currentMap[] ) { remove_quotes ( map ) strtolower( map ) while( replace( map, len, "/", "" ) ) {} while( replace( map, len, "\", "" ) ) {} while( replace( map, len, ":", "" ) ) {} while( replace( map, len, "*", "" ) ) {} while( replace( map, len, "?", "" ) ) {} while( replace( map, len, ">", "" ) ) {} while( replace( map, len, "<", "" ) ) {} while( replace( map, len, "|", "" ) ) {} while( replace( map, len, ".", "" ) ) {} if( is_map_valid( map ) && !equali( map, g_lastMap ) && !equali( map, currentMap ) ) return true return false } stock isMapCycle( map[] ) { for( new i; i < g_mapNums; i++ ) if( equali( g_mapName[i], map ) ) return i return -1 } public team_score( ) { new team[2] read_data( 1, team, 1 ) g_teamScore[( team[0]=='C' ) ? 0 : 1] = read_data( 2 ) } public pcvar_register( const pcvar_name[], const pcvar_value[] ) { new pcvar_index = get_cvar_pointer( pcvar_name ) if( !pcvar_index ) pcvar_index = register_cvar( pcvar_name, pcvar_value ) return pcvar_index } stock say_hudmessage( id, red=255, green=255, blue=255, Float:x=0.05, Float:y=0.45, effects=0, Float:fxtime=6.0, Float:holdtime=5.0, Float:fadeintime=0.5, Float:fadeouttime=0.15, channel=4, msg[], any:... ) { new arg_num = numargs() new arg_langid[16], arg_langcount for( new i = 12; i < arg_num; i++ ) if( getarg( i ) == AUTO_LANG ) arg_langid[arg_langcount++] = i new players[32], player, num if( id ) { players[0] = id num = 1 } else get_players( players, num ) set_hudmessage( red, green, blue, x, y, effects, fxtime, holdtime, fadeintime, fadeouttime, channel ) new message[192] for( new i; i < num; i++ ) { player = players[i] if( !is_user_connected( player ) ) continue for( new j; j < arg_langcount; j++ ) setarg( arg_langid[j], 0, player ) vformat( message, charsmax( message ), msg, 14 ) show_hudmessage( player, message ) } } public cmd_say_rtv( id ) { if( get_gametime( ) < ( get_pcvar_float( pcv_vote_delay ) * 60.0 ) ) { new timeleft = floatround( get_pcvar_float( pcv_vote_delay ) * 60.0 - get_gametime( ) ) client_print( id, print_chat, "%L", id, "RTV_NOTALLOWED", timeleft / 60, timeleft % 60 ) } else { if( g_rtv_vote[id - 1] == id ) client_print( id, print_chat, "%L", id, "RTV_ALREADY" ) else { g_rtv_vote[id - 1] = id g_rtv_count++ static players[32], num get_players( players, num, "ch" ) new Float:voteratio = floatclamp( get_pcvar_float ( pcv_votemap_ratio ), 0.0, 1.0 ) num = floatround( voteratio * num ) if( num <= g_rtv_count ) { g_rtv = true voteNextmap( ) return PLUGIN_CONTINUE } static name[32] get_user_name( id, name, charsmax( name ) ) client_print( 0, print_chat, "%L", LANG_PLAYER, "RTV_ADDVOTE", name, num - g_rtv_count, floatround( voteratio * 100.0 ) ) } } return PLUGIN_CONTINUE } public client_disconnect( id ) { if( g_rtv_vote[id - 1] == id ) { g_rtv_vote[id - 1] = 0 g_rtv_count-- } } public plugin_end( ) { if( g_timelimit ) set_pcvar_float( pcv_mp_timelimit, g_timelimit ) new current_map[32] get_mapname( current_map, charsmax( current_map ) ) set_localinfo( "lastMap", current_map ) return PLUGIN_CONTINUE } и плагин map on time 1.4 ]#include <amxmodx> #include <amxmisc> #include <core> #include <engine> #include <fakemeta> #include <orpheu> #include <nvault> #define PLUGIN "Map On Time" #define AUTHOR "Trofian" #define VERSION "1.4" #define IsPlayer(%1) (1 <= (%1) <= 32) #pragma tabsize 0 // global constants #define PATH_CFG "mot.ini" // global variables new g_massParams[32][32] new g_countParams new g_standartTimeleft new g_startTime_h[32] new g_stopTime_h[32] new g_startTime_m[32] new g_stopTime_m[32] new g_map[32][32] new g_nowMap[32] new g_nowStartTime_h new g_nowStopTime_h new g_nowStartTime_m new g_nowStopTime_m new g_nextMap[32] new g_nextStartTime_h new g_nextStopTime_h new g_nextStartTime_m new g_nextStopTime_m new bool:g_b_motModeOn = false new bool:g_b_hookTimeleft = false new bool:g_b_showhud = false new OrpheuFunction:o_IndexOfEdict public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_cvar("mp_timelimit","20") register_cvar("mot_show_hud","1") register_cvar("mot_light","0") register_dictionary("mot.txt") register_dictionary("timeleft.txt") OrpheuRegisterHook(OrpheuGetFunction("UTIL_ClientPrint"), "On_ClientPrint_Pre", OrpheuHookPre) o_IndexOfEdict = OrpheuGetFunction("IndexOfEdict") register_concmd("amx_mot","moton", ADMIN_SLAY,"<on/off>") g_standartTimeleft = get_cvar_num("mp_timelimit") read_cfg_and_calls() } public read_cfg_and_calls() { // func var's new f_configsDir[64] new f_numSymb new f_line = 0 new f_textline[32] new f_period = 0 //------------------- get_configsdir(f_configsDir, 63) format(f_configsDir, 63, "%s/%s", f_configsDir, PATH_CFG) if (!file_exists(f_configsDir)) { server_print("[%s] File ^"%s^" doesn't exist.", PLUGIN, f_configsDir) return PLUGIN_HANDLED } while (f_line = read_file (f_configsDir, f_line, f_textline, 255, f_numSymb)) { g_massParams[f_period] = f_textline analysisOfParameters(f_period) f_period = f_period + 1 } g_countParams = f_period-1 pre_chek() return PLUGIN_CONTINUE } public analysisOfParameters(num) { // func var's new f_all[32] new f_temp[6] //------------------- f_all = g_massParams[num] // start time h & convert format(f_temp,5,"%s%s",f_all[0], f_all[1]) g_startTime_h[num] = str_to_num(f_temp) // stop time h & convert format(f_temp,5,"%s%s",f_all[6], f_all[7]) g_stopTime_h[num] = str_to_num(f_temp) // start time m & convert format(f_temp,5,"%s%s",f_all[3], f_all[4]) g_startTime_m[num] = str_to_num(f_temp) // stop time m & convert format(f_temp, 5,"%s%s",f_all[9], f_all[10]) g_stopTime_m[num] = str_to_num(f_temp) // map name for (new i = 0; i<20; i++) { g_map[num][i] = f_all[i+12] } return PLUGIN_CONTINUE } public pre_chek() { if (g_countParams+1 == 0) { server_print("[%s] Error: Config file is empty!", PLUGIN) return PLUGIN_HANDLED } if(g_countParams+1 < 0) { server_print("[%s] Error: Unknown error! (debug: g_countParams = %d)", PLUGIN, g_countParams) return PLUGIN_HANDLED } if(g_countParams+1 >= 1) { set_task (5.0, "chek_and_show") } return PLUGIN_CONTINUE } public chek_and_show() { // func var's new f_timeHours new f_timeMinutes new f_map[32] new f_nowStartTime[32] new f_nowStopTime[32] new f_nextStartTime[32] new f_nextStopTime[32] //------------------- set_task (25.0, "chek_and_show") time (f_timeHours, f_timeMinutes) get_mapname(f_map, 31) for (new i = 0; i<=g_countParams; i++) { if(f_timeHours == g_startTime_h[i] && f_timeMinutes == g_startTime_m[i]) { if(g_b_motModeOn == true || equali(f_map, g_map[i])) { g_b_motModeOn = true g_nowMap = g_map[i] g_nowStartTime_h = g_startTime_h[i] g_nowStopTime_h = g_stopTime_h[i] g_nowStartTime_m = g_startTime_m[i] g_nowStopTime_m = g_stopTime_m[i] g_nextMap = g_map[i+1] g_nextStartTime_h = g_startTime_h[i+1] g_nextStopTime_h = g_stopTime_h[i+1] g_nextStartTime_m = g_startTime_m[i+1] g_nextStopTime_m = g_stopTime_m[i+1] g_b_hookTimeleft = true g_b_showhud = true server_cmd("mp_timelimit 0") switch (get_cvar_num("mot_light")) { case 0: { // nothing } case 1: { engfunc(EngFunc_LightStyle, 0, 107) } case 2: { engfunc(EngFunc_LightStyle, 0, 105) } case 3: { engfunc(EngFunc_LightStyle, 0, 103) } } }else{ server_cmd("changelevel %s", g_map[i]) } } else if(f_timeHours == g_stopTime_h[i] && f_timeMinutes == g_stopTime_m[i]) { if(g_b_motModeOn == true) { server_cmd("mp_timelimit %d", g_standartTimeleft) g_b_motModeOn = false } g_b_motModeOn = false g_b_showhud = false g_b_hookTimeleft = false } if(g_b_showhud == true && get_cvar_num("mot_show_hud") == 1) { format(f_nowStartTime, 31, "%d", g_nowStartTime_m) format(f_nowStopTime, 31, "%d", g_nowStopTime_m) format(f_nextStartTime, 31, "%d", g_nextStartTime_m) format(f_nextStopTime, 31, "%d", g_nextStopTime_m) if(g_nowStartTime_m >=0 && g_nowStartTime_m <= 9) format(f_nowStartTime, 31, "0%d", g_nowStartTime_m) if(g_nowStopTime_m >=0 && g_nowStopTime_m <= 9) format(f_nowStopTime, 31, "0%d", g_nowStopTime_m) if(g_nextStartTime_m >=0 && g_nextStartTime_m <= 9) format(f_nextStartTime, 31, "0%d", g_nextStartTime_m) if(g_nextStopTime_m >=0 && g_nextStopTime_m <= 9) format(f_nextStopTime, 31, "0%d", g_nextStopTime_m) if(g_nowStopTime_h == g_nextStartTime_h && g_nowStopTime_m == g_nextStartTime_m) { set_hudmessage(0, 255, 0, 0.16, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_ON", g_nowMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) set_hudmessage(0, 255, 0, 0.50, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_NEXT_MAP", g_nextMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nextStartTime_h, f_nextStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nextStopTime_h, f_nextStopTime) }else{ set_hudmessage(0, 255, 0, 0.16, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_ON", g_nowMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) } } } } // hook timeleft // http://amx-x.ru/viewtopic.php?f=9&t=1439 public OrpheuHookReturn:On_ClientPrint_Pre(p_Edict, i_Type, s_Message[190]) { if (g_b_hookTimeleft == true) { // func var's new f_text[32] new f_nowStartTime[32] new f_nowStopTime[32] //------------------- format(f_nowStartTime, 31, "%d", g_nowStartTime_m) format(f_nowStopTime, 31, "%d", g_nowStopTime_m) if(g_nowStartTime_m >=0 && g_nowStartTime_m <= 9) format(f_nowStartTime, 31, "0%d", g_nowStartTime_m) if(g_nowStopTime_m >=0 && g_nowStopTime_m <= 9) format(f_nowStopTime, 31, "0%d", g_nowStopTime_m) format (f_text, 31, "%L", LANG_PLAYER, "NO_T_LIMIT") trim(s_Message) if (equal(s_Message, f_text) && i_Type == print_chat) { static id id = OrpheuCall(o_IndexOfEdict, p_Edict) if (IsPlayer(id)) { client_print(id, i_Type, "%L %s %L %d:%s %L %d:%s", LANG_PLAYER, "CHAT_PRINT", g_nowMap, LANG_PLAYER, "HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER, "HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) return OrpheuSupercede } } return OrpheuIgnored } return OrpheuIgnored } public moton(id, level, cid) { if (!cmd_access(id, level, cid, 3)) return PLUGIN_HANDLED // func var's new f_a_motoffon[16] //------------------- read_argv(1, f_a_motoffon, 15) if(equali(f_a_motoffon, "off")) { server_cmd("mp_timelimit %d", g_standartTimeleft) g_b_motModeOn = false g_b_showhud = false g_b_hookTimeleft = false engfunc(EngFunc_LightStyle, 0, 109) client_print(id, print_console, "[%s] Night Mode stoped^n[%s] In 25 seconds hud will off", PLUGIN, PLUGIN) }else{ client_print(id, print_console, "[%s] What... What do you want?^n[%s] You can stop Night mode: ^"amx_mot off^"", PLUGIN, PLUGIN) } return PLUGIN_CONTINUE } Во время ночного режима когда люди прописывают "rtv" то начинаются меняться мапы без конца! как можно заблокировать "rtv" на ночной режим?
Отредактировал: Akushi, - 6.9.2011, 9:51
|
|
|
|
JIokoMoTuB
|
6.9.2011, 12:10
Сообщение
|
![]() |
супер че, приват выкладывать.
![]() Empower isn't phoenix
|
|
|
|
Akushi
|
6.9.2011, 12:33
Сообщение
|
![]() |
|
|
|
|
JIokoMoTuB
|
6.9.2011, 14:54
Сообщение
|
![]() |
Код Rebuilding by UFPS.Team
![]() Empower isn't phoenix
|
|
|
|
djdredd
|
6.9.2011, 14:54
Сообщение
|
![]() |
|
|
|
|
JIokoMoTuB
|
6.9.2011, 14:56
Сообщение
|
![]() |
Это не приват И это не UMM ладно ладно, затролите еще не дай бог. впринципи мне пофиг) не мой плагин и ладно. ![]() Empower isn't phoenix
|
|
|
|
Akushi
|
6.9.2011, 18:09
Сообщение
|
![]() |
|
|
|
|
Akushi
|
7.9.2011, 23:15
Сообщение
|
![]() |
А в map on time 1.4 когда начало ночного режима umm_voteratio 0 а в конце umm_voteratio 0.6 Ну что-то вроде этого Можешь помочь до конца? :biggrin: я вот понять не могу где тут начало и конец... #include <amxmodx> #include <amxmisc> #include <core> #include <engine> #include <fakemeta> #include <orpheu> #include <nvault> #define PLUGIN "Map On Time" #define AUTHOR "Trofian" #define VERSION "1.4" #define IsPlayer(%1) (1 <= (%1) <= 32) #pragma tabsize 0 // global constants #define PATH_CFG "mot.ini" // global variables new g_massParams[32][32] new g_countParams new g_standartTimeleft new g_startTime_h[32] new g_stopTime_h[32] new g_startTime_m[32] new g_stopTime_m[32] new g_map[32][32] new g_nowMap[32] new g_nowStartTime_h new g_nowStopTime_h new g_nowStartTime_m new g_nowStopTime_m new g_nextMap[32] new g_nextStartTime_h new g_nextStopTime_h new g_nextStartTime_m new g_nextStopTime_m new bool:g_b_motModeOn = false new bool:g_b_hookTimeleft = false new bool:g_b_showhud = false new OrpheuFunction:o_IndexOfEdict public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_cvar("mp_timelimit","20") register_cvar("mot_show_hud","1") register_cvar("mot_light","0") register_dictionary("mot.txt") register_dictionary("timeleft.txt") OrpheuRegisterHook(OrpheuGetFunction("UTIL_ClientPrint"), "On_ClientPrint_Pre", OrpheuHookPre) o_IndexOfEdict = OrpheuGetFunction("IndexOfEdict") register_concmd("amx_mot","moton", ADMIN_SLAY,"<on/off>") g_standartTimeleft = get_cvar_num("mp_timelimit") read_cfg_and_calls() } public read_cfg_and_calls() { // func var's new f_configsDir[64] new f_numSymb new f_line = 0 new f_textline[32] new f_period = 0 //------------------- get_configsdir(f_configsDir, 63) format(f_configsDir, 63, "%s/%s", f_configsDir, PATH_CFG) if (!file_exists(f_configsDir)) { server_print("[%s] File ^"%s^" doesn't exist.", PLUGIN, f_configsDir) return PLUGIN_HANDLED } while (f_line = read_file (f_configsDir, f_line, f_textline, 255, f_numSymb)) { g_massParams[f_period] = f_textline analysisOfParameters(f_period) f_period = f_period + 1 } g_countParams = f_period-1 pre_chek() return PLUGIN_CONTINUE } public analysisOfParameters(num) { // func var's new f_all[32] new f_temp[6] //------------------- f_all = g_massParams[num] // start time h & convert format(f_temp,5,"%s%s",f_all[0], f_all[1]) g_startTime_h[num] = str_to_num(f_temp) // stop time h & convert format(f_temp,5,"%s%s",f_all[6], f_all[7]) g_stopTime_h[num] = str_to_num(f_temp) // start time m & convert format(f_temp,5,"%s%s",f_all[3], f_all[4]) g_startTime_m[num] = str_to_num(f_temp) // stop time m & convert format(f_temp, 5,"%s%s",f_all[9], f_all[10]) g_stopTime_m[num] = str_to_num(f_temp) // map name for (new i = 0; i<20; i++) { g_map[num][i] = f_all[i+12] } return PLUGIN_CONTINUE } public pre_chek() { if (g_countParams+1 == 0) { server_print("[%s] Error: Config file is empty!", PLUGIN) return PLUGIN_HANDLED } if(g_countParams+1 < 0) { server_print("[%s] Error: Unknown error! (debug: g_countParams = %d)", PLUGIN, g_countParams) return PLUGIN_HANDLED } if(g_countParams+1 >= 1) { set_task (5.0, "chek_and_show") } return PLUGIN_CONTINUE } public chek_and_show() { // func var's new f_timeHours new f_timeMinutes new f_map[32] new f_nowStartTime[32] new f_nowStopTime[32] new f_nextStartTime[32] new f_nextStopTime[32] //------------------- set_task (25.0, "chek_and_show") time (f_timeHours, f_timeMinutes) get_mapname(f_map, 31) for (new i = 0; i<=g_countParams; i++) { if(f_timeHours == g_startTime_h[i] && f_timeMinutes == g_startTime_m[i]) { if(g_b_motModeOn == true || equali(f_map, g_map[i])) { g_b_motModeOn = true g_nowMap = g_map[i] g_nowStartTime_h = g_startTime_h[i] g_nowStopTime_h = g_stopTime_h[i] g_nowStartTime_m = g_startTime_m[i] g_nowStopTime_m = g_stopTime_m[i] g_nextMap = g_map[i+1] g_nextStartTime_h = g_startTime_h[i+1] g_nextStopTime_h = g_stopTime_h[i+1] g_nextStartTime_m = g_startTime_m[i+1] g_nextStopTime_m = g_stopTime_m[i+1] g_b_hookTimeleft = true g_b_showhud = true server_cmd("mp_timelimit 0") switch (get_cvar_num("mot_light")) { case 0: { // nothing } case 1: { engfunc(EngFunc_LightStyle, 0, 107) } case 2: { engfunc(EngFunc_LightStyle, 0, 105) } case 3: { engfunc(EngFunc_LightStyle, 0, 103) } } }else{ server_cmd("changelevel %s", g_map[i]) } } else if(f_timeHours == g_stopTime_h[i] && f_timeMinutes == g_stopTime_m[i]) { if(g_b_motModeOn == true) { server_cmd("mp_timelimit %d", g_standartTimeleft) g_b_motModeOn = false } g_b_motModeOn = false g_b_showhud = false g_b_hookTimeleft = false } if(g_b_showhud == true && get_cvar_num("mot_show_hud") == 1) { format(f_nowStartTime, 31, "%d", g_nowStartTime_m) format(f_nowStopTime, 31, "%d", g_nowStopTime_m) format(f_nextStartTime, 31, "%d", g_nextStartTime_m) format(f_nextStopTime, 31, "%d", g_nextStopTime_m) if(g_nowStartTime_m >=0 && g_nowStartTime_m <= 9) format(f_nowStartTime, 31, "0%d", g_nowStartTime_m) if(g_nowStopTime_m >=0 && g_nowStopTime_m <= 9) format(f_nowStopTime, 31, "0%d", g_nowStopTime_m) if(g_nextStartTime_m >=0 && g_nextStartTime_m <= 9) format(f_nextStartTime, 31, "0%d", g_nextStartTime_m) if(g_nextStopTime_m >=0 && g_nextStopTime_m <= 9) format(f_nextStopTime, 31, "0%d", g_nextStopTime_m) if(g_nowStopTime_h == g_nextStartTime_h && g_nowStopTime_m == g_nextStartTime_m) { set_hudmessage(0, 255, 0, 0.16, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_ON", g_nowMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) set_hudmessage(0, 255, 0, 0.50, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_NEXT_MAP", g_nextMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nextStartTime_h, f_nextStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nextStopTime_h, f_nextStopTime) }else{ set_hudmessage(0, 255, 0, 0.16, 0.0, 0, 26.0, 26.0, 0.1, 0.1, -1) show_hudmessage (0, "%L %s^n%L %d:%s %L %d:%s^n" ,LANG_PLAYER, "HUD_MESSAGE_ON", g_nowMap , LANG_PLAYER,"HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER,"HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) } } } } // hook timeleft // http://amx-x.ru/viewtopic.php?f=9&t=1439 public OrpheuHookReturn:On_ClientPrint_Pre(p_Edict, i_Type, s_Message[190]) { if (g_b_hookTimeleft == true) { // func var's new f_text[32] new f_nowStartTime[32] new f_nowStopTime[32] //------------------- format(f_nowStartTime, 31, "%d", g_nowStartTime_m) format(f_nowStopTime, 31, "%d", g_nowStopTime_m) if(g_nowStartTime_m >=0 && g_nowStartTime_m <= 9) format(f_nowStartTime, 31, "0%d", g_nowStartTime_m) if(g_nowStopTime_m >=0 && g_nowStopTime_m <= 9) format(f_nowStopTime, 31, "0%d", g_nowStopTime_m) format (f_text, 31, "%L", LANG_PLAYER, "NO_T_LIMIT") trim(s_Message) if (equal(s_Message, f_text) && i_Type == print_chat) { static id id = OrpheuCall(o_IndexOfEdict, p_Edict) if (IsPlayer(id)) { client_print(id, i_Type, "%L %s %L %d:%s %L %d:%s", LANG_PLAYER, "CHAT_PRINT", g_nowMap, LANG_PLAYER, "HUD_MESSAGE_ON_BEGIN", g_nowStartTime_h, f_nowStartTime, LANG_PLAYER, "HUD_MESSAGE_ON_END", g_nowStopTime_h, f_nowStopTime) return OrpheuSupercede } } return OrpheuIgnored } return OrpheuIgnored } public moton(id, level, cid) { if (!cmd_access(id, level, cid, 3)) return PLUGIN_HANDLED // func var's new f_a_motoffon[16] //------------------- read_argv(1, f_a_motoffon, 15) if(equali(f_a_motoffon, "off")) { server_cmd("mp_timelimit %d", g_standartTimeleft) g_b_motModeOn = false g_b_showhud = false g_b_hookTimeleft = false engfunc(EngFunc_LightStyle, 0, 109) client_print(id, print_console, "[%s] Night Mode stoped^n[%s] In 25 seconds hud will off", PLUGIN, PLUGIN) }else{ client_print(id, print_console, "[%s] What... What do you want?^n[%s] You can stop Night mode: ^"amx_mot off^"", PLUGIN, PLUGIN) } return PLUGIN_CONTINUE } |
|
|
|
![]() ![]() |