Plugino.
Posted: 2013 Jan 28 09:18
Reikalingus pluginas kuris nuo tam tikros valandos iki tam tikros suteikia bit flagus.
Code: Select all
#include < amxmodx >#include < hamsandwich > #pragma semicolon 1 #define PLUGIN_NAME "21:00 | 9:00"#define PLUGIN_VERSION "0.1"#define PLUGIN_AUTHOR "AGAMES.LT" #define PLUGIN_PREFIX "[FREE VIP]"#define SETTED_FLAGS "bit"#define TIME_INTERVAL 60 new bool:b_Access[ 33 ];new g_msgid_SayText; public plugin_init( ){ register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR ); RegisterHam( Ham_Spawn, "player", "ham_Spawn", 1 ); set_task( float( TIME_INTERVAL ), "task_check_time", 0, "", 0, "b" ); g_msgid_SayText = get_user_msgid( "SayText" );} public client_connect( id ){ b_Access[ id ] = false;} public client_putinserver( id ){ b_Access[ id ] = false;} public client_disconnect( id ){ b_Access[ id ] = false;} public ham_Spawn( id ){ if ( !is_user_connected( id ) ) return HAM_IGNORED; if ( !( get_user_flags( id ) & ADMIN_USER ) ) return HAM_IGNORED; if ( b_Access[ id ] ) { set_user_flags( id, get_user_flags( id ) | read_flags( "bit" ) ); echo_colored( id, "!g%s !yNuo 21:00 iki 9:00 visi gauna free VIP! Dabar jus esate VIP!", PLUGIN_PREFIX ); } else { remove_user_flags( id, read_flags( SETTED_FLAGS ) ); } return HAM_IGNORED;} public task_check_time( ){ new hours[ 8 ], nHours; get_time( "%H", hours, charsmax( hours ) ); nHours = str_to_num( hours ); new players[ 32 ], pnum, i; get_players( players, pnum ); for ( i = 0; i < pnum; i++ ) { if ( ( nHours >= 21 ) || ( nHours <= 09 ) ) { b_Access[ players[ i ] ] = true; } else { b_Access[ players[ i ] ] = false; } }} stock echo_colored( id, string[ ], any:... ){ new szmsg[ 192 ]; vformat( szmsg, charsmax( szmsg ), string, 3 ); replace_all( szmsg, charsmax( szmsg ), "!y", "^x01" ); replace_all( szmsg, charsmax( szmsg ), "!t", "^x03" ); replace_all( szmsg, charsmax( szmsg ), "!g", "^x04" ); message_begin( MSG_ONE, g_msgid_SayText, { 0,0,0 }, id ); write_byte( id ); write_string( szmsg ); message_end( );}