Solved Need help with break info

Coding Help/Re-API Supported
Post Reply
Claudio-vip
Member
Member
Posts: 17
Joined: 4 years ago
Contact:

Need help with break info

#1

Post by Claudio-vip » 3 years ago

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

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

#2

Post by Night Fury » 3 years ago

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

Claudio-vip
Member
Member
Posts: 17
Joined: 4 years ago
Contact:

#3

Post by Claudio-vip » 3 years ago

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

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

#4

Post by Night Fury » 3 years ago

Change

Code: Select all

player = players;
To

Code: Select all

player = players[i];
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Claudio-vip
Member
Member
Posts: 17
Joined: 4 years ago
Contact:

#5

Post by Claudio-vip » 3 years ago

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();
		}
	}
}

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

#6

Post by Night Fury » 3 years ago

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?
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Claudio-vip
Member
Member
Posts: 17
Joined: 4 years ago
Contact:

#7

Post by Claudio-vip » 3 years ago

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();
		}
	}
}

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#8

Post by VicKy » 2 years ago

can you make to show in consule
Image

User avatar
Amnesia
Member
Member
Posts: 27
Joined: 2 years ago
Contact:

#9

Post by Amnesia » 2 years ago

Ty for Break / Button Info <3

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