hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.07.04. 09:38



Jelenlévő felhasználók

Jelenleg 360 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 359 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Sounded Welcoming Messages
HozzászólásElküldve:2012.08.03. 22:43 
Offline
Őstag
Avatar

Csatlakozott:2012.02.14. 15:09
Hozzászólások:1423
Megköszönték neki: 2 alkalommal
Ezt a plugint csak annyira szeretném átírni, hogy pl mapváltáskor több játékos csatlakozik egyszerre és egybemosódik a fenti hud üzenetbe, hogy kik jönnek, úgy kéne nekem hogy gyorsan váltogasson 1 hud üzenetet amikor mapváltás van vagy valami, ha nem is lehet elolvasni kik jönnek legalább ne legyen ronda.
Kód:
  1. /*

  2. * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

  3. *               Sounded Welcoming Messages                                      *

  4. *                                                                                                               *  

  5. *       Changelog:                                                                                      *

  6. *    v1.0                                                                                               *

  7. *    -Frist Release                                                                             *

  8. *                                                                                                               *

  9. * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

  10. */

  11. #include <amxmodx>

  12.  

  13. #define PLUGIN "Sounded Welcoming Messages"

  14. #define VERZIO "1.1"

  15. #define KESZITO "kiki33"

  16.  

  17. #pragma tabsize 1

  18.  

  19. #define CENTER          -1.0

  20. #define JOINMSG         0.02

  21. #define JOINEDMSG       0.05

  22. #define LEAVEMSG        0.9

  23.  

  24. stock __dhud_color;

  25. stock __dhud_x;

  26. stock __dhud_y;

  27. stock __dhud_effect;

  28. stock __dhud_fxtime;

  29. stock __dhud_holdtime;

  30. stock __dhud_fadeintime;

  31. stock __dhud_fadeouttime;

  32. stock __dhud_reliable;

  33.  

  34. new g_OnOff;

  35. new SoundOnOff;

  36. new hostname[ 64 ];

  37. static nev[33]

  38.  

  39. /* To load multiple sounds, put the individual files between " signs and separate them with commas */

  40. new const WelComeSounds[][] =

  41. {

  42.     "misc/welcomesound.wav"

  43. }

  44.  

  45. public plugin_init()  

  46. {

  47.                 //Register Plugin

  48.                 register_plugin( PLUGIN, VERZIO, KESZITO)

  49.                 //Cvars

  50.                 g_OnOff =  register_cvar("amx_welcome_plugin", "1");  // Enable/Disable the plugin with this cvar!

  51.                 SoundOnOff = register_cvar("amx_welcome_sound", "1"); // Enable/Disable the sounds with this cvar!

  52.                

  53.                 //Multilang file

  54.                 register_dictionary("welcome.txt")

  55. }

  56.  

  57. public plugin_precache()

  58. {

  59.  

  60.         for(new a = 0; a < sizeof(WelComeSounds); a++)

  61.         precache_sound(WelComeSounds[a]);

  62.  

  63.        

  64.         return PLUGIN_CONTINUE

  65. }

  66.  

  67. public client_connect(id) {

  68.  

  69.     set_task(2.0, "joinmsg", id)

  70.     return PLUGIN_CONTINUE

  71. }

  72.  

  73. public client_putinserver(id) {

  74.  

  75.     set_task(8.0, "joinedmsg", id)

  76.     return PLUGIN_CONTINUE  

  77. }

  78.  

  79. public client_disconnect(id) {

  80.  

  81.    set_task(2.0, "leavemsg", id)  

  82.    return PLUGIN_CONTINUE  

  83. }

  84.  

  85. public joinmsg(id)

  86. {

  87.     if( get_pcvar_num(g_OnOff) )

  88.     {

  89.                 get_user_name(id, nev, charsmax(nev))

  90.                 set_dhudmessage(255, 0, 0, CENTER, JOINMSG, 2, 6.0, 3.0, 0.1, 1.5 )

  91.                 show_dhudmessage(0, "^%L", id, "CSATLAKOZAS", nev)

  92.     }

  93. }

  94.  

  95. public joinedmsg(id)

  96. {

  97.     if( get_pcvar_num(g_OnOff) )

  98.     {

  99.                 get_user_name(id, nev, charsmax(nev))

  100.                 get_cvar_string("hostname",hostname,63)  

  101.                 set_dhudmessage(255, 165, 0, JOINEDMSG, CENTER, 2, 6.0, 3.0, 0.1, 1.5 )

  102.                 show_dhudmessage(id, "^%L", id, "BELEPES", nev, hostname)

  103.         }

  104.        

  105.     if( get_pcvar_num(SoundOnOff) )

  106.         {

  107.                 client_cmd(id, "spk ^"%s^"", WelComeSounds[random(sizeof(WelComeSounds))])     

  108.         }

  109. }

  110.  

  111. public leavemsg(id)

  112. {

  113.      if( get_pcvar_num(g_OnOff) )

  114.     {

  115.                         get_user_name(id, nev, charsmax(nev))

  116.                         set_dhudmessage(0, 255, 0, CENTER, LEAVEMSG, 2, 6.0, 3.0, 0.1, 1.5 )

  117.                         show_dhudmessage(0, "^%L", id, "KILEPES", nev)

  118.     }

  119. }

  120.  

  121. 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 )

  122. {

  123.     #define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )

  124.     #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

  125.  

  126.     __dhud_color       = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );

  127.     __dhud_x           = _:x;

  128.     __dhud_y           = _:y;

  129.     __dhud_effect      = effects;

  130.     __dhud_fxtime      = _:fxtime;

  131.     __dhud_holdtime    = _:holdtime;

  132.     __dhud_fadeintime  = _:fadeintime;

  133.     __dhud_fadeouttime = _:fadeouttime;

  134.     __dhud_reliable    = _:reliable;

  135.  

  136.     return 1;

  137. }

  138.  

  139. stock show_dhudmessage( index, const message[], any:... )

  140. {

  141.     new buffer[ 128 ];

  142.     new numArguments = numargs();

  143.  

  144.     if( numArguments == 2 )

  145.     {

  146.         send_dhudMessage( index, message );

  147.     }

  148.     else if( index || numArguments == 3 )

  149.     {

  150.         vformat( buffer, charsmax( buffer ), message, 3 );

  151.         send_dhudMessage( index, buffer );

  152.     }

  153.     else

  154.     {

  155.         new playersList[ 32 ], numPlayers;

  156.         get_players( playersList, numPlayers, "ch" );

  157.  

  158.         if( !numPlayers )

  159.         {

  160.             return 0;

  161.         }

  162.  

  163.         new Array:handleArrayML = ArrayCreate();

  164.  

  165.         for( new i = 2, j; i < numArguments; i++ )

  166.         {

  167.             if( getarg( i ) == LANG_PLAYER )

  168.             {

  169.                 while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}

  170.                 j = 0;

  171.  

  172.                 if( GetLangTransKey( buffer ) != TransKey_Bad )

  173.                 {

  174.                     ArrayPushCell( handleArrayML, i++ );

  175.                 }

  176.             }

  177.         }

  178.  

  179.         new size = ArraySize( handleArrayML );

  180.  

  181.         if( !size )

  182.         {

  183.             vformat( buffer, charsmax( buffer ), message, 3 );

  184.             send_dhudMessage( index, buffer );

  185.         }

  186.         else

  187.         {

  188.             for( new i = 0, j; i < numPlayers; i++ )

  189.             {

  190.                 index = playersList[ i ];

  191.  

  192.                 for( j = 0; j < size; j++ )

  193.                 {

  194.                     setarg( ArrayGetCell( handleArrayML, j ), 0, index );

  195.                 }

  196.  

  197.                 vformat( buffer, charsmax( buffer ), message, 3 );

  198.                 send_dhudMessage( index, buffer );

  199.             }

  200.         }

  201.  

  202.         ArrayDestroy( handleArrayML );

  203.     }

  204.  

  205.     return 1;

  206. }

  207.  

  208. stock send_dhudMessage( const index, const message[] )

  209. {

  210.     message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );

  211.     {

  212.         write_byte( strlen( message ) + 31 );

  213.         write_byte( DRC_CMD_MESSAGE );

  214.         write_byte( __dhud_effect );

  215.         write_long( __dhud_color );

  216.         write_long( __dhud_x );

  217.         write_long( __dhud_y );

  218.         write_long( __dhud_fadeintime );

  219.         write_long( __dhud_fadeouttime );

  220.         write_long( __dhud_holdtime );

  221.         write_long( __dhud_fxtime );

  222.         write_string( message );

  223.     }

  224.     message_end();

  225. }

  226.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 2 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole