Resolved Need help with break info

Coding Help/Re-API Supported
Post Reply
Claudio-vip
Member
Member
Posts: 10
Joined: 5 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

Need help with break info

#1

Post by Claudio-vip » 3 Weeks 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
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 648
Joined: 3 Years Ago
Location: Egypt
Has thanked: 35 times
Been thanked: 50 times
Age: 20
Contact:

#2

Post by Mohamed Alaa » 3 Weeks 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 web projects.
CS 1.6 hosting: powergamingtech.com

Claudio-vip
Member
Member
Posts: 10
Joined: 5 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#3

Post by Claudio-vip » 3 Weeks 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
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 648
Joined: 3 Years Ago
Location: Egypt
Has thanked: 35 times
Been thanked: 50 times
Age: 20
Contact:

#4

Post by Mohamed Alaa » 3 Weeks Ago

Change

Code: Select all

player = players;
To

Code: Select all

player = players[i];
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

Claudio-vip
Member
Member
Posts: 10
Joined: 5 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#5

Post by Claudio-vip » 3 Weeks 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
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 648
Joined: 3 Years Ago
Location: Egypt
Has thanked: 35 times
Been thanked: 50 times
Age: 20
Contact:

#6

Post by Mohamed Alaa » 3 Weeks 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 web projects.
CS 1.6 hosting: powergamingtech.com

Claudio-vip
Member
Member
Posts: 10
Joined: 5 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#7

Post by Claudio-vip » 3 Weeks 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();
		}
	}
}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests