Page 2 of 3

Re: Button button_detector flood stop.

Posted: 26 Jan 2018, 12:36
by xxGamerxx
I got error when i compile it:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// ze_escape_button_detector_no_flood.sma
//
// D:\scripting\ze_escape_button_detector_no_flood.sma(19) : warning 213: tag mismatch
// D:\scripting\ze_escape_button_detector_no_flood.sma(19) : error 035: argument type mismatch (argument 3)
//
// 1 Error.
// Could not locate output file D:\scripting\compiled\ze_escape_button_detector_no_flood.amx (compile failed).
//
// Compilation Time: 0.91 sec
// ----------------------------------------

Press enter to exit ...

Re: Button button_detector flood stop.

Posted: 26 Jan 2018, 13:15
by Obada
Try this bro:

https://forums.alliedmods.net/showthread.php?t=280657

When i go home, i'll try to made it.

Re: Button button_detector flood stop.

Posted: 26 Jan 2018, 14:21
by Obada
Try this:

Code: Select all

#include <zombie_escape>
#include <amxmisc>

new not_allow 

public plugin_init ()
{
	register_plugin("[ZE] Escape Button Detector", "1.1", "Raheem")
	RegisterHam(Ham_Use, "func_button", "Fw_ButtonUsed_Post", 1)
}

public Fw_ButtonUsed_Post(iEnt, iCallerID)
{
	new szTargetName[51]; get_entvar(iEnt, var_target, szTargetName, charsmax(szTargetName))
	new szCallerName[32]; get_user_name(iCallerID, szCallerName, charsmax(szCallerName))
	
	
	if(!not_allow)
	{
		// Player Pressed button is Human?
		if (!ze_is_user_zombie(iCallerID))
		{
			for(new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
			{
				if (is_user_admin(id))
				{
					ze_colored_print(id, "!tButton pressed by!y: !g%s", szCallerName)
					not_allow = true
					set_task(5.0, "allow")
				}
			}
		}
	}

}

public allow(id)
{
    not_allow = false
}

Re: Button button_detector flood stop.

Posted: 26 Jan 2018, 16:19
by Raheem
OK, Here it's:
  • Code: Select all

    #include <zombie_escape>
    #include <amxmisc>
    
    // Variables
    new Float:g_flLastUsed[33]
    
    // Cvars
    new pCvarFloodTime
    
    public plugin_init ()
    {
    	register_plugin("[ZE] Admin Button Message", "1.1", "Raheem")
    	
    	// Hams
    	RegisterHam(Ham_Use, "func_button", "Fw_ButtonUsed_Post", 1)
    	
    	// Cvar
    	pCvarFloodTime = register_cvar("ze_button_message_flood_time", "0.5")
    }
    
    public Fw_ButtonUsed_Post(iEnt, iCallerID)
    {
    	new szTargetName[51]; get_entvar(iEnt, var_target, szTargetName, charsmax(szTargetName))
    	new szCallerName[32]; get_user_name(iCallerID, szCallerName, charsmax(szCallerName))
    	
    	// Player Pressed button is Human?
    	if (!ze_is_user_zombie(iCallerID))
    	{
    		for(new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    		{
    			if (is_user_admin(id))
    			{
    				if ((get_gametime() - g_flLastUsed[iCallerID]) > get_pcvar_float(pCvarFloodTime))
    				{
    					ze_colored_print(id, "!tButton pressed by!y: !g%s", szCallerName)
    					g_flLastUsed[iCallerID] = get_gametime()
    				}
    			}
    		}
    	}
    }
Cvar ze_button_message_flood_time 0.5 can take any value (Integer or Float) examples: 0.001 - 0.01 - 0.1 - 5 .. etc

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 02:14
by xxGamerxx
Thank you!

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 16:10
by Rain1153
Raheem it's not working players can still spam button

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 16:17
by Raheem
OH, Fixed i should concentrate next time.. Sorry for this.

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 16:20
by Rain1153
i'm trying obada's one i think it should help

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 16:36
by Rain1153
It's ok bro what did you modify in the code? btw

Re: Button button_detector flood stop.

Posted: 27 Jan 2018, 16:43
by Rain1153
[Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
[Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
This is the one i'm talking about!