Page 1 of 1

[ZE] Show Button Pressed BUG

Posted: 25 Mar 2019, 18:25
by Templaso
Can someone take an eye on my plugin? Got some errors when try to compile it:

error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 4)
error 035: argument type mismatch (argument 1)

ze_showbuttonpressed.sma
(1.52 KiB) Downloaded 348 times
ze_showbuttonpressed.sma
(1.52 KiB) Downloaded 348 times

Re: [ZE] Show Button Pressed BUG

Posted: 26 Mar 2019, 19:00
by Raheem
Not related to our Mod, but here you are:

  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4.  
  5. new const TAG[] = "[ZE]";
  6.  
  7. new g_msgsaytext, bool:g_buttons[1000];
  8.  
  9. new g_butoane;
  10.  
  11. public plugin_init()
  12. {
  13.     RegisterHam(Ham_Use, "func_button", "FwdUseButtonPost", 1);
  14.     register_logevent("endround", 2, "1=Round_End");
  15.    
  16.     take_buttons();
  17.     g_msgsaytext = get_user_msgid("SayText");
  18.     g_butoane = 0;
  19. }
  20.  
  21. public take_buttons()
  22. {
  23.     g_butoane = 0;
  24.     new entid = -1;
  25.     while((entid = engfunc(EngFunc_FindEntityByString, entid, "classname", "func_button")))
  26.     {
  27.         if(!pev_valid(entid))
  28.             continue;
  29.        
  30.         g_buttons[entid] = false;
  31.         g_butoane++;
  32.     }
  33.     server_print("%d butoane ****", g_butoane);
  34. }
  35.  
  36. public endround()
  37.     take_buttons();
  38.  
  39. public FwdUseButtonPost(ent, caller, activator)
  40. {
  41.     if(!g_buttons[ent])
  42.     {
  43.         new name[32];
  44.         get_user_name(activator, name, charsmax(name));
  45.         color(0, ".v%s.g Player.e %s.g press a button!", TAG, name);
  46.         g_buttons[ent] = true;
  47.     }
  48. }
  49.  
  50. stock color( const id, const input[], any: ... )
  51. {
  52.     new count = 1, players[32], i, player;
  53.     static msg[191];
  54.     if ( numargs() == 2 )
  55.         copy( msg, 190, input );
  56.     else
  57.         vformat( msg, 190, input, 3 );
  58.     replace_all( msg, 190, "!g", "^4" );
  59.     replace_all( msg, 190, "!y", "^1" );
  60.     replace_all( msg, 190, "!t", "^3" );
  61.     if ( id )
  62.     {
  63.         if ( !is_user_connected( id ) ) return;
  64.         players[0] = id;
  65.     } else get_players( players, count, "ch" );
  66.     for ( i = 0; i < count; i++ )
  67.     {
  68.         player = players[i];
  69.         message_begin( MSG_ONE_UNRELIABLE, g_msgsaytext, _, player );
  70.         write_byte( player );
  71.         write_string( msg );
  72.         message_end();
  73.     }
  74. }

Re: [ZE] Show Button Pressed BUG

Posted: 27 Mar 2019, 06:51
by Templaso
It's working fine, thank you! :)