Page 1 of 1

Need help with break info

Posted: 03 May 2020, 11:14
by Claudio-vip
Hello people.I need some help with break info which tell you who broke something on the map on the zombie escape server.The problem is that I want the plugin to work only for admins because I dont want so make so much spam in the chat for the players.
Spoiler!
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define ADMIN_LEVEL_F
public plugin_init()
{
register_plugin( "Breakable", "1.0", "Raheem" );
RegisterHam( Ham_TakeDamage, "func_breakable", "ham_attacked" );

}
public ham_attacked( ent, weapon, killer, dmg )
{
new health = pev( ent, pev_health );
if ( health - dmg <= 0.0 )
{
static name[32];
get_user_name( killer, name, charsmax( name ) );
print_colored( 0, "!y**** !g Player !t%s !gis Breaking Something !y****", name );
return(HAM_IGNORED);
}
return(HAM_IGNORED);
}

/* 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;
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player );
write_byte( player );
write_string( msg );
message_end();
}
}



If you can to make this plugin only for admins or to give me a

Re: Need help with break info

Posted: 03 May 2020, 21:09
by Night Fury

Code: Select all

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define ADMIN_FLAG ADMIN_LEVEL_F
public plugin_init()
{
	register_plugin( "Breakable", "1.0", "Raheem" );
	RegisterHam( Ham_TakeDamage, "func_breakable", "ham_attacked" );
}
public ham_attacked( ent, weapon, killer, dmg )
{
	new health = pev( ent, pev_health );
	if ( health - dmg <= 0.0 )
	{
		static name[32];
		get_user_name( killer, name, charsmax( name ) );
		for (new i = 0; i < get_maxplayers(); i++)
		{
			if (is_user_connected(i) && get_user_flags(i) & ADMIN_FLAG)
			{
				print_colored( i, "!y**** !g Player !t%s !gis Breaking Something !y****", name );
			}
		}
		return(HAM_IGNORED);
	}
	return(HAM_IGNORED);
}

/* 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;
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, player );
write_byte( player );
write_string( msg );
message_end();
}
}

Re: Need help with break info

Posted: 04 May 2020, 11:29
by Claudio-vip
I get this error when I try to compile.
Spoiler!
//// break_info.sma
// C:\Users\claud\OneDrive\Desktop\cs sv\Sma\break_info.sma(50) : error 006: must be assigned to an array
//
// 1 Error.
// Could not locate output file C:\Users\claud\OneDrive\Desktop\cs sv\Sma\compiled\break_info.amx (compile failed).
//
// Compilation Time: 0,2 sec
// -----------------------------------

Re: Need help with break info

Posted: 04 May 2020, 23:37
by Night Fury
Change

Code: Select all

player = players;
To

Code: Select all

player = players[i];

Re: Need help with break info

Posted: 05 May 2020, 09:17
by Claudio-vip
Thank you it works!.Can you do this and at the buton info plugin? I tried by myself but I failed. I don't have so much experience in scripting,sorry :/.

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define PLUGIN "[ZP] Plugin: Show Button Pressed"
#define VERSION "1.0"
#define AUTHOR "[P]erfec[T] [S]cr[@]s[H]"

new anti_flood_last_ent[33]

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Use, "func_button", "fw_UseStationary")
	RegisterHam(Ham_Use, "func_rot_button", "fw_UseStationary")
}

public fw_UseStationary(entity, caller, activator, use_type)
{
	if(anti_flood_last_ent[caller] == entity)
		return HAM_IGNORED
	
	static class[32]
	static name[32]; get_user_name(caller, name, 31);
	entity_get_string(entity, EV_SZ_targetname, class, 31) 

	if(!class[0])
		entity_get_string(entity, EV_SZ_target, class, 31)
		
	client_printcolor(0, "*** BUTTON PRESSED BY %s ***", name)

	anti_flood_last_ent[caller] = entity
	remove_task(caller)
	set_task(3.0, "anti_flood_reset", caller)

	return HAM_IGNORED
}

public anti_flood_reset(id) anti_flood_last_ent[id] = 0

stock client_printcolor(const id,const input[], any:...)
{
	new msg[191], players[32], count = 1; vformat(msg,190,input,3);
	replace_all(msg,190,"!g","^4");    // green
	replace_all(msg,190,"!y","^1");    // normal
	replace_all(msg,190,"!t","^3");    // team
	
	if (id) players[0] = id; else get_players(players,count,"ch");
	
	for (new i=0;i<count;i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}

Re: Need help with break info

Posted: 06 May 2020, 04:45
by Night Fury

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define PLUGIN "[ZP] Plugin: Show Button Pressed"
#define VERSION "1.0"
#define AUTHOR "[P]erfec[T] [S]cr[@]s[H]"

#define ADMIN_FLAG ADMIN_SLAY

new anti_flood_last_ent[33]

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Use, "func_button", "fw_UseStationary")
	RegisterHam(Ham_Use, "func_rot_button", "fw_UseStationary")
}

public fw_UseStationary(entity, caller, activator, use_type)
{
	if(anti_flood_last_ent[caller] == entity)
		return HAM_IGNORED
	
	static class[32]
	static name[32]; get_user_name(caller, name, 31);
	entity_get_string(entity, EV_SZ_targetname, class, 31) 

	if(!class[0])
		entity_get_string(entity, EV_SZ_target, class, 31)
		
	for (new i = 0; i < get_maxplayers(); i++)
	{
		if (is_user_connected(i) && get_user_flags(i) & ADMIN_FLAG)
		{
			client_printcolor(i, "*** BUTTON PRESSED BY %s ***", name)
		}
	}
	client_printcolor(0, "*** BUTTON PRESSED BY %s ***", name)

	anti_flood_last_ent[caller] = entity
	remove_task(caller)
	set_task(3.0, "anti_flood_reset", caller)

	return HAM_IGNORED
}

public anti_flood_reset(id) anti_flood_last_ent[id] = 0

stock client_printcolor(const id,const input[], any:...)
{
	new msg[191], players[32], count = 1; vformat(msg,190,input,3);
	replace_all(msg,190,"!g","^4");    // green
	replace_all(msg,190,"!y","^1");    // normal
	replace_all(msg,190,"!t","^3");    // team
	
	if (id) players[0] = id; else get_players(players,count,"ch");
	
	for (new i=0;i<count;i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
Are you using our ZE mod?

Re: Need help with break info

Posted: 06 May 2020, 06:36
by Claudio-vip
Thank you bro <3.It works but you had to remove the second client_printcolor because players could see the info.Nevermind I solved it it had to be like that.Thank you for your help bro.Big respect! And no,I'm using the old zombie escape mod 2.2 :)
/* Plugin generated by AMXX-Studio */

Code: Select all

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define PLUGIN "[ZP] Plugin: Show Button Pressed"
#define VERSION "1.0"
#define AUTHOR "[P]erfec[T] [S]cr[@]s[H]"

#define ADMIN_FLAG ADMIN_LEVEL_F

new anti_flood_last_ent[33]

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Use, "func_button", "fw_UseStationary")
	RegisterHam(Ham_Use, "func_rot_button", "fw_UseStationary")
}

public fw_UseStationary(entity, caller, activator, use_type)
{
	if(anti_flood_last_ent[caller] == entity)
		return HAM_IGNORED
	
	static class[32]
	static name[32]; get_user_name(caller, name, 31);
	entity_get_string(entity, EV_SZ_targetname, class, 31) 

	if(!class[0])
		entity_get_string(entity, EV_SZ_target, class, 31)
		
	for (new i = 0; i < get_maxplayers(); i++)
	{
		if (is_user_connected(i) && get_user_flags(i) & ADMIN_FLAG)
		{
			client_printcolor(i, "*** BUTTON PRESSED BY %s ***", name)
		}
	}

	anti_flood_last_ent[caller] = entity
	remove_task(caller)
	set_task(3.0, "anti_flood_reset", caller)

	return HAM_IGNORED
}

public anti_flood_reset(id) anti_flood_last_ent[id] = 0

stock client_printcolor(const id,const input[], any:...)
{
	new msg[191], players[32], count = 1; vformat(msg,190,input,3);
	replace_all(msg,190,"!g","^4");    // green
	replace_all(msg,190,"!y","^1");    // normal
	replace_all(msg,190,"!t","^3");    // team
	
	if (id) players[0] = id; else get_players(players,count,"ch");
	
	for (new i=0;i<count;i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}

Re: Need help with break info

Posted: 30 Jun 2021, 12:41
by VicKy
can you make to show in consule

Re: Need help with break info

Posted: 05 Dec 2021, 08:07
by Amnesia
Ty for Break / Button Info <3