Approved Press Button Info

Gameplay Addons
czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 439
Joined: 1 Year Ago
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Press Button Info

#21

Post by czirimbolo » 3 Months Ago

Raheem wrote:
1 Year Ago
+Like sam. And it may cause some spam so we may make it appear for admins only.
Can you make it appear for admins only? Now, every player see this message
Image

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 3 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#22

Post by Mark » 3 Months Ago

czirimbolo wrote:
3 Months Ago
Raheem wrote:
1 Year Ago
+Like sam. And it may cause some spam so we may make it appear for admins only.
Can you make it appear for admins only? Now, every player see this message
This should only show to Admin with ADMIN_CHECK ADMIN_KICK //Flag C
  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN    "Button Info"
  4. #define AUTHOR    "SeRious_SaM"
  5. #define VERSION    "1.0"
  6. #define ADMIN_CHECK ADMIN_KICK //Flag C
  7.  
  8. public plugin_init()
  9. {
  10.     register_plugin(PLUGIN, VERSION, AUTHOR)
  11.     RegisterHam(Ham_Use,"func_button","fwButtonUsed",1)
  12. }
  13.  
  14.    
  15. public fwButtonUsed( ent, idcaller )
  16.     {
  17.         new szName[33];
  18.         get_user_name( idcaller, szName, charsmax( szName ) );
  19.        
  20.         if(get_user_flags(idcaller) & ADMIN_CHECK)
  21.         {
  22.             ze_colored_print( 0, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName );
  23.         }
  24.     }
  25.  
  26. /* Color Stocks */
  27. stock print_colored( const id, const input[], any: ... )
  28. {
  29.     new count = 1, players[32], i, player;
  30.     static msg[191];
  31.     if ( numargs() == 2 )
  32.         copy( msg, 190, input );
  33.     else
  34.         vformat( msg, 190, input, 3 );
  35.     replace_all( msg, 190, "!g", "^4" );
  36.     replace_all( msg, 190, "!y", "^1" );
  37.     replace_all( msg, 190, "!t", "^3" );
  38.     if ( id )
  39.     {
  40.         if ( !is_user_connected( id ) ) return;
  41.         players[0] = id;
  42.     } else get_players( players, count, "ch" );
  43.     for ( i = 0; i < count; i++ )
  44.     {
  45.         player = players[i];
  46.         message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player );
  47.         write_byte( player );
  48.         write_string( msg );
  49.         message_end();
  50.     }
  51. }

User avatar
sPe3doN
Senior Member
Senior Member
Bosnia & Herzegovina
Posts: 144
Joined: 1 Year Ago
Has thanked: 12 times
Been thanked: 2 times
Age: 19
Contact:

#23

Post by sPe3doN » 3 Months Ago

Mark wrote:
3 Months Ago
czirimbolo wrote:
3 Months Ago
Raheem wrote:
1 Year Ago
+Like sam. And it may cause some spam so we may make it appear for admins only.
Can you make it appear for admins only? Now, every player see this message
This should only show to Admin with ADMIN_CHECK ADMIN_KICK //Flag C
  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN    "Button Info"
  4. #define AUTHOR    "SeRious_SaM"
  5. #define VERSION    "1.0"
  6. #define ADMIN_CHECK ADMIN_KICK //Flag C
  7.  
  8. public plugin_init()
  9. {
  10.     register_plugin(PLUGIN, VERSION, AUTHOR)
  11.     RegisterHam(Ham_Use,"func_button","fwButtonUsed",1)
  12. }
  13.  
  14.    
  15. public fwButtonUsed( ent, idcaller )
  16.     {
  17.         new szName[33];
  18.         get_user_name( idcaller, szName, charsmax( szName ) );
  19.        
  20.         if(get_user_flags(idcaller) & ADMIN_CHECK)
  21.         {
  22.             ze_colored_print( 0, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName );
  23.         }
  24.     }
  25.  
  26. /* Color Stocks */
  27. stock print_colored( const id, const input[], any: ... )
  28. {
  29.     new count = 1, players[32], i, player;
  30.     static msg[191];
  31.     if ( numargs() == 2 )
  32.         copy( msg, 190, input );
  33.     else
  34.         vformat( msg, 190, input, 3 );
  35.     replace_all( msg, 190, "!g", "^4" );
  36.     replace_all( msg, 190, "!y", "^1" );
  37.     replace_all( msg, 190, "!t", "^3" );
  38.     if ( id )
  39.     {
  40.         if ( !is_user_connected( id ) ) return;
  41.         players[0] = id;
  42.     } else get_players( players, count, "ch" );
  43.     for ( i = 0; i < count; i++ )
  44.     {
  45.         player = players[i];
  46.         message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player );
  47.         write_byte( player );
  48.         write_string( msg );
  49.         message_end();
  50.     }
  51. }
this will show for admin only if aonther admin use the button

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#24

Post by Raheem » 3 Months Ago

  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN    "Button Info"
  4. #define AUTHOR    "SeRious_SaM"
  5. #define VERSION    "1.0"
  6. #define ADMIN_CHECK ADMIN_KICK //Flag C
  7.  
  8. new g_iMaxPlayers
  9.  
  10. public plugin_init()
  11. {
  12.     register_plugin(PLUGIN, VERSION, AUTHOR)
  13.     RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1)
  14.    
  15.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
  16. }
  17.  
  18.    
  19. public Fw_ButtonUsed_Post(iEnt, iCaller)
  20. {
  21.     new szName[32];
  22.     get_user_name(iCaller, szName, charsmax(szName));
  23.    
  24.     for(new id = 1; id <= g_iMaxPlayers; id++)
  25.     {
  26.         if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK))
  27.             continue
  28.        
  29.         ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName);
  30.     }
  31. }
These users thanked the author Raheem for the post:
sPe3doN (3 Months Ago)
You don't know? Learn and you will know.

shady101852
Member
Member
United States of America
Posts: 27
Joined: 2 Months Ago
Has thanked: 9 times
Been thanked: 2 times
Contact:

#25

Post by shady101852 » 2 Months Ago

Raheem wrote:
3 Months Ago
  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN    "Button Info"
  4. #define AUTHOR    "SeRious_SaM"
  5. #define VERSION    "1.0"
  6. #define ADMIN_CHECK ADMIN_KICK //Flag C
  7.  
  8. new g_iMaxPlayers
  9.  
  10. public plugin_init()
  11. {
  12.     register_plugin(PLUGIN, VERSION, AUTHOR)
  13.     RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1)
  14.    
  15.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
  16. }
  17.  
  18.    
  19. public Fw_ButtonUsed_Post(iEnt, iCaller)
  20. {
  21.     new szName[32];
  22.     get_user_name(iCaller, szName, charsmax(szName));
  23.    
  24.     for(new id = 1; id <= g_iMaxPlayers; id++)
  25.     {
  26.         if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK))
  27.             continue
  28.        
  29.         ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName);
  30.     }
  31. }
any way to prevent chat spam with this? If someone spams a button the chat will be spammed as well xD

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#26

Post by Raheem » 2 Months Ago

We can add delay but won't be useful as maybe one close door and not printed on chat.

If you have good idea for limiting this, let me know.

[ Post made via Nexus 7 ]
You don't know? Learn and you will know.

shady101852
Member
Member
United States of America
Posts: 27
Joined: 2 Months Ago
Has thanked: 9 times
Been thanked: 2 times
Contact:

#27

Post by shady101852 » 2 Months Ago

Raheem wrote:
2 Months Ago
We can add delay but won't be useful as maybe one close door and not printed on chat.

If you have good idea for limiting this, let me know.
If a player presses a button 2 times in a duration of 5 seconds, block the rest of his button messages for the next 5 seconds. Example: I open a door, then i close it.
Shady pressed a button
Shady pressed a button
After that second one the rest of the messages will be blocked for the next 5 seconds. Now lets have another situation.
Shady pressed a button
In this case, if the player doesn't press a button again in the next 5 seconds, the message block limit will be reset and he can press the button 2 more times again
Shady pressed a button
Shady pressed a button
Then message block.

Do not do this:
Shady pressed a button
After 5 seconds:
Shady pressed a button
(do not block the chat at this point)

So basically they can still spam, but only every 5 seconds. And their limiter gets reset every 5 seconds. Not sure if this is possible but I think its a good way to deal with it. It would be good if you can do this on the version that shows the message only to admins since not many people will be aware of the chat message, but its still a little precaution that could be useful. I can't imagine someone needing to press a button more than once in 10 seconds unless they want to open and close a door or something.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#28

Post by Raheem » 2 Months Ago

Player pressed button, it will print message that he pressed. Then after 5 seconds it will print again if he pressed. If he pressed during delay then nothing will be printed.

  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN    "Button Info"
  4. #define AUTHOR    "SeRious_SaM"
  5. #define VERSION    "1.0"
  6. #define ADMIN_CHECK ADMIN_KICK //Flag C
  7.  
  8. #define DELAY 5 // Delay 5 second for same user
  9.  
  10. new g_iMaxPlayers
  11.  
  12. new g_iLastUsed[33]
  13.  
  14. public plugin_init()
  15. {
  16.     register_plugin(PLUGIN, VERSION, AUTHOR)
  17.     RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1)
  18.    
  19.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
  20. }
  21.  
  22. public Fw_ButtonUsed_Post(iEnt, iCaller)
  23. {
  24.     new szName[32];
  25.     get_user_name(iCaller, szName, charsmax(szName));
  26.    
  27.     for(new id = 1; id <= g_iMaxPlayers; id++)
  28.     {
  29.         if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK))
  30.             continue
  31.        
  32.         if (floatround(get_gametime()) >= g_iLastUsed[iCaller] + DELAY)
  33.         {
  34.             ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName);
  35.            
  36.             g_iLastUsed[iCaller] = floatround(get_gametime());
  37.         }
  38.     }
  39. }
These users thanked the author Raheem for the post:
shady101852 (1 Month Ago)
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests