Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #define CHAT_TAG "^x04[AMXX]^x01"
- new const FILE[] = "addons/amxmodx/configs/reclame.ini";
- new Array: g_Messages;
- public plugin_init ( ) set_task ( 3.0, "incarcare_reclame" );
- public incarcare_reclame ( )
- {
- if ( g_Messages ) ArrayDestroy ( g_Messages );
- g_Messages = ArrayCreate ( 512 );
- new a = fopen ( FILE, "r" );
- if ( a )
- {
- new Line [ 512 ];
- while ( !feof ( a ) )
- {
- fgets ( a, Line, charsmax ( Line ) );
- trim ( Line );
- ArrayPushString ( g_Messages, Line );
- }
- fclose ( a );
- }
- if ( ArraySize ( g_Messages ) )
- set_task ( 60.0, "afisare_reclama", .flags="b" );
- }
- public afisare_reclama ( )
- {
- new Count = 1, Players [ 32 ], Mesaj [ 512 ];
- ArrayGetString ( g_Messages, random_num ( 0, ArraySize ( g_Messages ) -1 ), Mesaj, charsmax ( Mesaj ) );
- get_players ( Players, Count, "ch" );
- for ( new i = 0; i < Count; i++ )
- {
- new Player = Players [ i ];
- if ( is_user_connected ( Player ) || !is_user_hltv ( Player ) || !is_user_bot ( Player ) )
- {
- new String [ 512 ];
- formatex ( String, charsmax ( String ), "%s %s", CHAT_TAG, Mesaj );
- message_begin ( MSG_ONE_UNRELIABLE, get_user_msgid ( "SayText" ), _, Player );
- write_byte ( Player );
- write_string ( String );
- message_end ( );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement