Raised This Month: $ Target: $400
 0% 

MSG_ONE or MSG_ONE_UNRELIABLE with no target entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 05-20-2020 , 12:41   Re: MSG_ONE or MSG_ONE_UNRELIABLE with no target entity
Reply With Quote #3

Quote:
Originally Posted by DJEarthQuake View Post
Code:
#include < amxmodx > #include < hamsandwich > #define IsValidPlayer(%0)   ( 1 <= %0 <= g_iMaxPlayers ) new g_bConnected[ 33 ] = false; new g_bAlive[ 33 ] = false; new g_iTeam[ 33 ]; new g_szName[ 33 ][ 32 ]; new bool: g_bHasPrefix[ 33 ] = false; new g_iMessageChat; new g_iMaxPlayers; public plugin_init( ) {     register_plugin( "VIP: Chat Prefix for user info", "2.0", "Milutinke (ByM)" );         RegisterHam( Ham_Spawn, "player", "fw_HamPlayerSpawnPost", .Post = true );         register_event( "TeamInfo", "fw_EventTeamInfo", "a" );         register_clcmd( "say", "fw_ChatPrefix" );     register_clcmd( "say_team", "fw_ChatPrefixTeam" );         g_iMessageChat = get_user_msgid( "SayText" );     g_iMaxPlayers = get_maxplayers( ); } public fw_HamPlayerSpawnPost( iPlayer ) {     g_bConnected[ iPlayer ] = bool: is_user_connected( iPlayer );     g_bAlive[ iPlayer ] = bool: is_user_alive( iPlayer ); } public client_connect( iPlayer ) {     g_bHasPrefix[ iPlayer ] = false;     g_bConnected[ iPlayer ] = false;     g_bAlive[ iPlayer ] = false;     g_iTeam[ iPlayer ] = 0; } public client_putinserver( iPlayer )     g_bConnected[ iPlayer ] = true; public client_authorized( iPlayer ) {     get_user_name( iPlayer, g_szName[ iPlayer ], charsmax( g_szName[ ] ) );         new szInfo[ 32 ];     if( get_user_info( iPlayer, "vip", szInfo, charsmax( szInfo ) ) ) {         trim( szInfo );                 if( szInfo[ 0 ] == EOS )             return;                     g_bHasPrefix[ iPlayer ] = bool: equal( szInfo, "1" );     } }    #if AMXX_VERSION_NUM < 183; public client_disconnect(iPlayer)     #else public client_disconnected(iPlayer)     #endif {     g_szName[ iPlayer ][ 0 ] = EOS;     g_bHasPrefix[ iPlayer ] = false;     g_bConnected[ iPlayer ] = false;     g_bAlive[ iPlayer ] = false;     g_iTeam[ iPlayer ] = 0; } public client_infochanged( iPlayer ) {     new szName[ 32 ];     get_user_name( iPlayer, szName, charsmax( szName ) );         if( !equal( g_szName[ iPlayer ], szName ) )         copy( g_szName[ iPlayer ], charsmax( g_szName[ ] ), szName ); } public fw_EventTeamInfo( ) {     new iPlayer = read_data( 1 );         if( !g_bConnected[ iPlayer ] )         return PLUGIN_CONTINUE;         new szTeam[ 12 ];     read_data( 2, szTeam, charsmax( szTeam ) );         switch( szTeam[ 0 ] ) {         case 'T' :  g_iTeam[ iPlayer ] = 1;         case 'C' :  g_iTeam[ iPlayer ] = 2;         case 'S' :  g_iTeam[ iPlayer ] = 3;         default: g_iTeam[ iPlayer ] = 4;     }         return PLUGIN_CONTINUE; } public fw_ChatPrefix( iPlayer ) {     if( is_vip_by_info(iPlayer ))     if( !g_bConnected[ iPlayer ] || !IsValidPlayer( iPlayer ) )         return 2;             static szSaid[ 191 ];     read_args( szSaid, charsmax( szSaid ) );     remove_quotes( szSaid );         return ChatPrefix( iPlayer, szSaid, charsmax( szSaid ), false ); } public fw_ChatPrefixTeam( iPlayer ) {     if( !g_bConnected[ iPlayer ] || !IsValidPlayer( iPlayer ) )         return 2;             static szSaid[ 191 ];     read_args( szSaid, charsmax( szSaid ) );     remove_quotes( szSaid );         return ChatPrefix( iPlayer, szSaid, charsmax( szSaid ), true ); } public ChatPrefix( const iPlayer, szSaid[ ], const iSaidLength, const bTeamChat ) {     static szMessage[ 191 ], iPlayers;     if( !szSaid[ 0 ] )         return 2;     formatex( szMessage, charsmax( szMessage ), "%s!t%s: !n%s", g_bHasPrefix[ iPlayer ] ? "!g[VIP] " : "", g_szName[ iPlayer ], szSaid );     replace_all( szMessage, charsmax( szMessage ), "%", "" );     replace_all( szMessage, charsmax( szMessage ), "!n", "^x01" );     replace_all( szMessage, charsmax( szMessage ), "!r", "^x02" );     replace_all( szMessage, charsmax( szMessage ), "!g", "^x04" );     replace_all( szMessage, charsmax( szMessage ), "!t", "^x03" );     trim( szMessage );         for( iPlayers = 1; iPlayers <= g_iMaxPlayers; iPlayers ++ ) {         if( !g_bConnected[ iPlayer ] || ( !g_bAlive[ iPlayer ] && g_bAlive[ iPlayers ] ) )             continue;                 if( bTeamChat ) {             if( get_user_team( iPlayer ) != get_user_team( iPlayers ) )                 continue;         }         if(is_user_connected(iPlayers)){         message_begin( MSG_ONE_UNRELIABLE, g_iMessageChat, { 0, 0, 0 }, iPlayers );         write_byte( iPlayer );         write_string( szMessage );         message_end( );         }     }     return 2; } stock bool:is_vip_by_info(iPlayer) {     static szInfo[5]     get_user_info(iPlayer, "vip", szInfo, charsmax(szInfo))     if( szInfo[0] == '1' )         return g_bHasPrefix[ iPlayer ] = true;     else return g_bHasPrefix[ iPlayer ] = false; }
Thanks it worked
supertrio17 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode