Solved Button button_detector flood stop.

Coding Help/Re-API Supported
xxGamerxx
Member
Member
Jordan
Posts: 13
Joined: 6 years ago
Contact:

#11

Post by xxGamerxx » 6 years ago

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 ...

Obada
Member
Member
Palestine
Posts: 27
Joined: 6 years ago
Contact:

#12

Post by Obada » 6 years ago

Try this bro:

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

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

Obada
Member
Member
Palestine
Posts: 27
Joined: 6 years ago
Contact:

#13

Post by Obada » 6 years ago

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
}

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#14

Post by Raheem » 6 years ago

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
Last edited by Raheem 6 years ago, edited 1 time in total.
Reason: FIXED
He who fails to plan is planning to fail

xxGamerxx
Member
Member
Jordan
Posts: 13
Joined: 6 years ago
Contact:

#15

Post by xxGamerxx » 6 years ago

Thank you!

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#16

Post by Rain1153 » 6 years ago

Raheem it's not working players can still spam button
LOL

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#17

Post by Raheem » 6 years ago

OH, Fixed i should concentrate next time.. Sorry for this.
He who fails to plan is planning to fail

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#18

Post by Rain1153 » 6 years ago

i'm trying obada's one i think it should help
LOL

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#19

Post by Rain1153 » 6 years ago

It's ok bro what did you modify in the code? btw
LOL

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#20

Post by Rain1153 » 6 years ago

[Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
[Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
This is the one i'm talking about!
LOL

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#21

Post by Raheem » 6 years ago

Rain1153 wrote: 6 years ago [Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
[Zombie Escape] [Zombie Escape] Chris Pressed the BUTTON!
This is the one i'm talking about!
You tested my code?
He who fails to plan is planning to fail

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#22

Post by Rain1153 » 6 years ago

yes but it seems to not work players can still spam
LOL

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#23

Post by Raheem » 6 years ago

Rain1153 wrote: 6 years ago yes but it seems to not work players can still spam
For this i tested it and it's working without any problem. Just make sure to change the cvar to any value you need as it's 0.5 sec so maybe you don't see the cvar: http://escapers-zone.net/viewtopic.php?p=5473#p5473
He who fails to plan is planning to fail

User avatar
sam_bhosale4
Mod Tester
Mod Tester
India
Posts: 109
Joined: 7 years ago
Location: INDIA
Contact:

#24

Post by sam_bhosale4 » 6 years ago

I guess hes talking about my plugin Press Button Info not escape button!
Because even i get flood by this button people spams too much!
plugin needs no flood delay..
-=SeRious-GaminG|Zombie Escape[Alien vs. Predator]|Asia=-
206.189.132.169:40000
Image

Obada
Member
Member
Palestine
Posts: 27
Joined: 6 years ago
Contact:

#25

Post by Obada » 6 years ago

sam_bhosale4 wrote: 6 years ago I guess hes talking about my plugin Press Button Info not escape button!
Because even i get flood by this button people spams too much!
plugin needs no flood delay..
About this,, you can use this edited plugin, ofcourse thanks to [mention]Raheem[/mention]

Code: Select all

#include <zombie_escape>
#include <amxmisc>

#define PLUGIN "Cooldown type command"
#define VERSION "1.0"
#define AUTHOR "Freeman"

#define MAX_PLAYERS 32

new CvarCooldown
new Float:CommandNextTime[MAX_PLAYERS+1]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    CvarCooldown = register_cvar("amx_cmd_cooldown", "60")

    RegisterHam(Ham_Use, "func_button", "Fw_ButtonUsed_Post", 1)
}

public Fw_ButtonUsed_Post(iEnt, id)
{
    new Float:gametime = get_gametime()
    new Float:command_next_time = CommandNextTime[id]

    if( gametime < command_next_time )
    {
        //new Float:timeleft = command_next_time - gametime
        //client_print(id, print_chat, "You must wait %.0f second%s to use this command", timeleft, (1.0 <= timeleft < 2.0) ? "s" : "")

        return
    }

    CommandNextTime[id] = gametime + get_pcvar_float(CvarCooldown) - 55
	
	new szTargetName[51]; get_entvar(iEnt, var_target, szTargetName, charsmax(szTargetName))
	new szCallerName[32]; get_user_name(id, szCallerName, charsmax(szCallerName))
	
			// Player Pressed button is Human?
		if (!ze_is_user_zombie(id))
		{
					ze_colored_print(0, "!tButton pressed by!y: !g%s", szCallerName)		
		}
		
		
    
}  
This make a delay for 5 second per player.

Post Reply

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

Register

Sign in

Who is online

Users browsing this forum: No registered users and 11 guests