Solved Button button_detector flood stop.

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

Button button_detector flood stop.

#1

Post by xxGamerxx » 6 years ago

Hello developers,

Can anyone edit this plugin ze_escape_button_detector.sma and make it no flood, i mean when someone press "e" every time the message occur and spam the chat. So if we can make a delay between every button message from same player like 1 second delay.

I see this plugin have same idea but it for radio flood not for button detector.

And thanks in advanced.

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

#2

Post by Raheem » 6 years ago

Welcome, ze_escape_button_detector plugin is for only detecting the button name and then you don't need it at all. First you use it to detect the button name then when you get name place it in zombie_escape.ini and remove this plugin at all. Only enable the escape button message plugin. Hope you get me.
He who fails to plan is planning to fail

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

#3

Post by xxGamerxx » 6 years ago

@[mention]Raheem[/mention] Thank you for your replay, i make edit on this button to show the player name who called the button, to force play team and no one closed/break on team. So i decide to make this plugin only for admins and no flood button msg.

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

#4

Post by xxGamerxx » 6 years ago

@raheem this is the code of my edit

Code: Select all

#include <zombie_escape>
#include <cstrike>

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))
	new CsTeams:team = cs_get_user_team(iCallerID) // Getting team 
	//ze_colored_print(iCallerID, "!tButton pressed by!y: !g%s", szCallerName) //this just show for self player
	
	//CS_TEAM_CT or CS_TEAM_T	
	if (team == CS_TEAM_CT){
		ze_colored_print(0, "!tButton pressed by!y: !g%s", szCallerName)
	}
}

I tried to show this message only to admins only ...

Code: Select all

#include <zombie_escape>
#include <cstrike>

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))
	new CsTeams:team = cs_get_user_team(iCallerID) // Getting team 
	//ze_colored_print(iCallerID, "!tButton pressed by!y: !g%s", szCallerName) //this just show for self player
	
	//CS_TEAM_CT or CS_TEAM_T	
	if (team == CS_TEAM_CT){
	if(is_user_admin(iCallerID)){
		ze_colored_print(0, "!tButton pressed by!y: !g%s", szCallerName)
		}
	}
}
But the problem this edited only show only when the caller is admin.

I need to replace "iCallerID" by each player id if the player admin or no.

Like

Code: Select all

for(every player in server == admin){
ze_colored_print(0, "!tButton pressed by!y: !g%s", szCallerName)
}
I hope to get solution from some developers here.

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

#5

Post by Raheem » 6 years ago

Here:
  • Code: Select all

    #include <zombie_escape>
    #include <amxmisc>
    
    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))
    	
    	// 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)
    			}
    		}
    	}
    }
He who fails to plan is planning to fail

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

#6

Post by xxGamerxx » 6 years ago

Thank you very much @raheem, bro do you have idea about abusing this fucntion so if we can do delay between first message and next message?

I'll try to do that but if you help me then we can save some time. <3

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

#7

Post by Raheem » 6 years ago

We can add delay but explain more how you need it to be.
He who fails to plan is planning to fail

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

#8

Post by Obada » 6 years ago

the purpose from delay is to prevent flood. for example if someone click on button for many times in less than 1 seconds you'll see the chat flooded by button message.

I search around i see this plugin https://cs-bg.info/plugin/936/ but this plugin for stop flooding the radio.

I go to try to make similar on button message, but no luck.

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

#9

Post by xxGamerxx » 6 years ago

Raheem wrote: 6 years ago We can add delay but explain more how you need it to be.
Like @Obada said my brother.

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#10

Post by Night Fury » 6 years ago

Try this:

Code: Select all

#include <zombie_escape>
#include <amxmisc>

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[64], szCallerName[32]
	get_entvar(iEnt, var_target, szTargetName, charsmax(szTargetName))
	get_user_name(iCallerID, szCallerName, charsmax(szCallerName))
	
	// Player Pressed button is Human?
	if (!ze_is_user_zombie(iCallerID))
	{
		set_task(30, "print", szCallerName, _, _, "a", 1)
	}
}

public print(szCallerName)
{
	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)
		}
	}
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

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

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 2 guests