[RLA] # HazZaRD Mesaje : 541 | Subiect: New Scroll Messages Lun 15 Feb 2016, 23:28 | |
| Descriere: Acest plugin este aproape identic cu cel default ( scrollmessages ) De ce am spus aproape identic? Ei bine eu nu am facut nimic altceva decat sa rescriu pluginul original si sa ii adaug "dhudmessage" Totodata i-am si adaptat cateva lucruri pentru ca nu erau compatibile. Descarcare: - Cod:
-
/* Plugin generated by AMXX-Studio */
#include < amxmodx > #include < dhudmessage >
#define PLUGIN "New Scroll Message" #define VERSION "0.0.3"
#define SM_TASK 112233
//Mesaje new const g_szScrollMessages[ ][ ] = { "Pentru admine vizitati http://www.google.ro sectiunea admine sau dati-va foc!", "Nu cereti xp pe server, in caz contrat veti fi confiscati conform regulamentului!", "Bun venit pe Server de Teste by Askhanar! Va uram o sedere placuta! Nu uitati sa ne adaugati la FAVORITES!" }
new Float:g_fSM_xPos;
new g_iSM_StartPos; new g_iSM_EndPos;
new g_iSM_Random; new g_iSM_Length;
new g_szScrollMessage[ 512 ];
new g_iCvarSMInterval;
public plugin_init( ) { // Original plugin was made by AMXX Dev Team. // I just rewrote the whole plugin and added dhudmessage. register_plugin(PLUGIN, VERSION, "Askhanar" );
register_clcmd( "amx_sm", "ClCmdAmxSM" );
g_iCvarSMInterval = register_cvar( "amx_newsm_interval", "300" ); set_task( float( get_pcvar_num( g_iCvarSMInterval ) ), "PrepareScrollMessage", SM_TASK );
// Add your code here...
}
public ClCmdAmxSM( id ) { if( !( get_user_flags( id ) & ADMIN_CVAR ) ) { client_cmd( id, "echo NU ai acces la aceasta comanda!" ); return PLUGIN_HANDLED; }
PrepareScrollMessage( );
return PLUGIN_HANDLED; }
public PrepareScrollMessage( ) {
remove_task( SM_TASK ); g_iSM_Random = random( sizeof ( g_szScrollMessages ) ); g_iSM_Length = strlen( g_szScrollMessages[ g_iSM_Random ] );
g_iSM_EndPos = 1; g_iSM_StartPos = 0; g_fSM_xPos = 0.53;
set_task( 0.3, "DisplayScrollMessage", SM_TASK, _, _, "a", g_iSM_Length + 48 ); client_print( 0, print_console, g_szScrollMessages[ g_iSM_Random ] );
set_task( float( get_pcvar_num( g_iCvarSMInterval ) ), "PrepareScrollMessage", SM_TASK ); }
public DisplayScrollMessage( ) { static iPos, i; iPos = g_iSM_StartPos; i = 0;
while( iPos < g_iSM_EndPos ) g_szScrollMessage[ i++ ] = g_szScrollMessages[ g_iSM_Random ][ iPos++ ];
g_szScrollMessage[ i ] = 0;
if( g_iSM_EndPos < g_iSM_Length ) g_iSM_EndPos++;
if( g_fSM_xPos > 0.20 ) g_fSM_xPos -= 0.0063; else { g_iSM_StartPos++; g_fSM_xPos = 0.20; }
set_dhudmessage( 0, 255, 255, g_fSM_xPos, 0.90, 0, 0.23, 0.23, 0.05, 0.05 ); show_dhudmessage( 0, g_szScrollMessage ); }[/sursa] De asemenea veti avea nevoie de urmatorul include.
[sursa=dhudmessage.inc]#if defined _dhudmessage_included #endinput #endif
#define _dhudmessage_included
#include <amxmodx>
stock __dhud_color; stock __dhud_x; stock __dhud_y; stock __dhud_effect; stock __dhud_fxtime; stock __dhud_holdtime; stock __dhud_fadeintime; stock __dhud_fadeouttime; stock __dhud_reliable;
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false ) { #define clamp_byte(%1) ( clamp( %1, 0, 255 ) ) #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
__dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) ); __dhud_x = _:x; __dhud_y = _:y; __dhud_effect = effects; __dhud_fxtime = _:fxtime; __dhud_holdtime = _:holdtime; __dhud_fadeintime = _:fadeintime; __dhud_fadeouttime = _:fadeouttime; __dhud_reliable = _:reliable;
return 1; }
stock show_dhudmessage( index, const message[], any:... ) { new buffer[ 128 ]; new numArguments = numargs();
if( numArguments == 2 ) { send_dhudMessage( index, message ); } else if( index || numArguments == 3 ) { vformat( buffer, charsmax( buffer ), message, 3 ); send_dhudMessage( index, buffer ); } else { new playersList[ 32 ], numPlayers; get_players( playersList, numPlayers, "ch" );
if( !numPlayers ) { return 0; }
new Array:handleArrayML = ArrayCreate();
for( new i = 2, j; i < numArguments; i++ ) { if( getarg( i ) == LANG_PLAYER ) { while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {} j = 0;
if( GetLangTransKey( buffer ) != TransKey_Bad ) { ArrayPushCell( handleArrayML, i++ ); } } }
new size = ArraySize( handleArrayML );
if( !size ) { vformat( buffer, charsmax( buffer ), message, 3 ); send_dhudMessage( index, buffer ); } else { for( new i = 0, j; i < numPlayers; i++ ) { index = playersList[ i ];
for( j = 0; j < size; j++ ) { setarg( ArrayGetCell( handleArrayML, j ), 0, index ); }
vformat( buffer, charsmax( buffer ), message, 3 ); send_dhudMessage( index, buffer ); } }
ArrayDestroy( handleArrayML ); }
return 1; }
stock send_dhudMessage( const index, const message[] ) { message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index ); { write_byte( strlen( message ) + 31 ); write_byte( DRC_CMD_MESSAGE ); write_byte( __dhud_effect ); write_long( __dhud_color ); write_long( __dhud_x ); write_long( __dhud_y ); write_long( __dhud_fadeintime ); write_long( __dhud_fadeouttime ); write_long( __dhud_holdtime ); write_long( __dhud_fxtime ); write_string( message ); } message_end(); } Nume: New Scroll Messages Versiune: 0.0.3 Instalare: 1. Fisierul New_ScrollMessages.sma il puneti in addons/amxmodx/scripting2. Fisierul New_ScrollMessages.amxx il puneti in addons/amxmodx/plugins3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma: - Cod:
-
New_ScrollMessages.amxx Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg): amx_newsm_interval 300 - secundele dintre fiecare mesaj. Comenzi administrative (se tasteaza in consola si ai nevoie de flag-ul ADMIN_CVAR ): amx_sm - afiseaza instant un scrollmesage la intamplare.
[sursa=Imagini] [/sursa]
|
|