Can you make it appear for admins only? Now, every player see this message
Press Button Info
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
This should only show to Admin with ADMIN_CHECK ADMIN_KICK //Flag Cczirimbolo wrote: ↑5 years agoCan you make it appear for admins only? Now, every player see this message
- #include <zombie_escape>
- #define PLUGIN "Button Info"
- #define AUTHOR "SeRious_SaM"
- #define VERSION "1.0"
- #define ADMIN_CHECK ADMIN_KICK //Flag C
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- RegisterHam(Ham_Use,"func_button","fwButtonUsed",1)
- }
- public fwButtonUsed( ent, idcaller )
- {
- new szName[33];
- get_user_name( idcaller, szName, charsmax( szName ) );
- if(get_user_flags(idcaller) & ADMIN_CHECK)
- {
- ze_colored_print( 0, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName );
- }
- }
- /* Color Stocks */
- stock print_colored( const id, const input[], any: ... )
- {
- new count = 1, players[32], i, player;
- static msg[191];
- if ( numargs() == 2 )
- copy( msg, 190, input );
- else
- vformat( msg, 190, input, 3 );
- replace_all( msg, 190, "!g", "^4" );
- replace_all( msg, 190, "!y", "^1" );
- replace_all( msg, 190, "!t", "^3" );
- if ( id )
- {
- if ( !is_user_connected( id ) ) return;
- players[0] = id;
- } else get_players( players, count, "ch" );
- for ( i = 0; i < count; i++ )
- {
- player = players[i];
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player );
- write_byte( player );
- write_string( msg );
- message_end();
- }
- }
this will show for admin only if aonther admin use the buttonMark wrote: ↑5 years agoThis should only show to Admin with ADMIN_CHECK ADMIN_KICK //Flag Cczirimbolo wrote: ↑5 years agoCan you make it appear for admins only? Now, every player see this message
#include <zombie_escape> #define PLUGIN "Button Info" #define AUTHOR "SeRious_SaM" #define VERSION "1.0" #define ADMIN_CHECK ADMIN_KICK //Flag C public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Use,"func_button","fwButtonUsed",1) } public fwButtonUsed( ent, idcaller ) { new szName[33]; get_user_name( idcaller, szName, charsmax( szName ) ); if(get_user_flags(idcaller) & ADMIN_CHECK) { ze_colored_print( 0, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName ); } } /* Color Stocks */ stock print_colored( const id, const input[], any: ... ) { new count = 1, players[32], i, player; static msg[191]; if ( numargs() == 2 ) copy( msg, 190, input ); else vformat( msg, 190, input, 3 ); replace_all( msg, 190, "!g", "^4" ); replace_all( msg, 190, "!y", "^1" ); replace_all( msg, 190, "!t", "^3" ); if ( id ) { if ( !is_user_connected( id ) ) return; players[0] = id; } else get_players( players, count, "ch" ); for ( i = 0; i < count; i++ ) { player = players[i]; message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player ); write_byte( player ); write_string( msg ); message_end(); } }
- #include <zombie_escape>
- #define PLUGIN "Button Info"
- #define AUTHOR "SeRious_SaM"
- #define VERSION "1.0"
- #define ADMIN_CHECK ADMIN_KICK //Flag C
- new g_iMaxPlayers
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1)
- g_iMaxPlayers = get_member_game(m_nMaxPlayers)
- }
- public Fw_ButtonUsed_Post(iEnt, iCaller)
- {
- new szName[32];
- get_user_name(iCaller, szName, charsmax(szName));
- for(new id = 1; id <= g_iMaxPlayers; id++)
- {
- if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK))
- continue
- ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName);
- }
- }
He who fails to plan is planning to fail
-
- Member
- Posts: 27
- Joined: 5 years ago
- Contact:
any way to prevent chat spam with this? If someone spams a button the chat will be spammed as well xDRaheem wrote: ↑5 years ago
#include <zombie_escape> #define PLUGIN "Button Info" #define AUTHOR "SeRious_SaM" #define VERSION "1.0" #define ADMIN_CHECK ADMIN_KICK //Flag C new g_iMaxPlayers public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1) g_iMaxPlayers = get_member_game(m_nMaxPlayers) } public Fw_ButtonUsed_Post(iEnt, iCaller) { new szName[32]; get_user_name(iCaller, szName, charsmax(szName)); for(new id = 1; id <= g_iMaxPlayers; id++) { if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK)) continue ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName); } }
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 you have good idea for limiting this, let me know.
He who fails to plan is planning to fail
-
- Member
- Posts: 27
- Joined: 5 years ago
- Contact:
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.
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
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 againShady pressed a button
Then message block.Shady pressed a button
Shady pressed a button
Do not do this:
After 5 seconds:Shady pressed a button
(do not block the chat at this point)Shady pressed a button
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.
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.
- #include <zombie_escape>
- #define PLUGIN "Button Info"
- #define AUTHOR "SeRious_SaM"
- #define VERSION "1.0"
- #define ADMIN_CHECK ADMIN_KICK //Flag C
- #define DELAY 5 // Delay 5 second for same user
- new g_iMaxPlayers
- new g_iLastUsed[33]
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1)
- g_iMaxPlayers = get_member_game(m_nMaxPlayers)
- }
- public Fw_ButtonUsed_Post(iEnt, iCaller)
- {
- new szName[32];
- get_user_name(iCaller, szName, charsmax(szName));
- for(new id = 1; id <= g_iMaxPlayers; id++)
- {
- if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK))
- continue
- if (floatround(get_gametime()) >= g_iLastUsed[iCaller] + DELAY)
- {
- ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName);
- g_iLastUsed[iCaller] = floatround(get_gametime());
- }
- }
- }
He who fails to plan is planning to fail
use this one for the delay on same playerRaheem wrote: ↑5 years 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.
#include <zombie_escape> #define PLUGIN "Button Info" #define AUTHOR "SeRious_SaM" #define VERSION "1.0" #define ADMIN_CHECK ADMIN_KICK //Flag C #define DELAY 5 // Delay 5 second for same user new g_iMaxPlayers new g_iLastUsed[33] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Use,"func_button","Fw_ButtonUsed_Post",1) g_iMaxPlayers = get_member_game(m_nMaxPlayers) } public Fw_ButtonUsed_Post(iEnt, iCaller) { new szName[32]; get_user_name(iCaller, szName, charsmax(szName)); for(new id = 1; id <= g_iMaxPlayers; id++) { if (!is_user_connected(id) || !(get_user_flags(id) & ADMIN_CHECK)) continue if (floatround(get_gametime()) >= g_iLastUsed[iCaller] + DELAY) { ze_colored_print(id, "!y[!gZombie Escape!y]!t %s !gPressed the BUTTON!y!", szName); g_iLastUsed[iCaller] = floatround(get_gametime()); } } }
increase the delay if needed
Hi, i just updated the plugin a bit.
Increase cooldown time TIME_COOLDOWN 5.0 if you want to see less message. It use amxmodx >= 183. I don't want to support old amxmodx version.
Code: Select all
#include <amxmodx>
#include <hamsandwich>
#include <reapi>
#define TIME_COOLDOWN 5.0
public plugin_init()
{
register_plugin("AMX183 Button Info", "1.0p", "SeRious_SaM,wbyokomo")
RegisterHam(Ham_Use, "func_button", "OnButtonPressedPost", 1)
}
public OnButtonPressedPost(ent, id)
{
static Float:fCurTime; fCurTime = get_gametime();
if(get_entvar(ent, var_flTimeStepSound) <= fCurTime)
{
set_entvar(ent, var_flTimeStepSound, fCurTime + TIME_COOLDOWN)
static szName[32]; get_user_name(id, szName, charsmax(szName));
client_print_color(0, id, "^4[Waifu Escape]^3 %s^1 just pressed a^3 BUTTON^1 !", szName)
}
}
[MMG]~Zombie-Escape-X
[MMG]~Zombie-Plague-X
[MMG]~Multi-Mod-X
[MMG]~Zombie-Plague-X
[MMG]~Multi-Mod-X
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 0 guests