Page 2 of 2
Re: Press Button Info
Posted: 04 Sep 2018, 11:42
by czirimbolo
Raheem wrote: ↑6 years 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
Re: Press Button Info
Posted: 04 Sep 2018, 22:45
by Mark
czirimbolo wrote: ↑5 years ago
Raheem wrote: ↑6 years 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
#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();
}
}
Re: Press Button Info
Posted: 05 Sep 2018, 20:04
by sPe3doN
Mark wrote: ↑5 years ago
czirimbolo wrote: ↑5 years ago
Raheem wrote: ↑6 years 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
#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 button
Re: Press Button Info
Posted: 09 Sep 2018, 00:26
by Raheem
#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);
}
}
Re: Press Button Info
Posted: 10 Oct 2018, 05:22
by shady101852
Raheem 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);
}
}
any way to prevent chat spam with this? If someone spams a button the chat will be spammed as well xD
Re: Press Button Info
Posted: 11 Oct 2018, 04:19
by Raheem
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.
Re: Press Button Info
Posted: 11 Oct 2018, 04:31
by shady101852
Raheem wrote: ↑5 years 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.
Re: Press Button Info
Posted: 12 Oct 2018, 09:19
by Raheem
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());
}
}
}
Re: Press Button Info
Posted: 29 Jun 2021, 12:52
by VicKy
can you make this only in consule
its spamming in server
Re: Press Button Info
Posted: 29 Jun 2021, 22:31
by karan
Raheem 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());
}
}
}
use this one for the delay on same player
Re: Press Button Info
Posted: 29 Jun 2021, 22:32
by karan
VicKy wrote: ↑2 years ago
can you make this only in consule
its spamming in server
increase the delay if needed
Re: Press Button Info
Posted: 23 Jul 2021, 09:38
by wbyokomo
Hi, i just updated the plugin a bit.
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)
}
}
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.