If you can to make this plugin only for admins or to give me a
Need help with break info
-
- Member
- Posts: 17
- Joined: 4 years ago
- Location: Romania
- Contact:
Need help with break info
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.
If you can to make this plugin only for admins or to give me a
Spoiler!
If you can to make this plugin only for admins or to give me a
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
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();
}
}
-
- Member
- Posts: 17
- Joined: 4 years ago
- Location: Romania
- Contact:
I get this error when I try to compile.
Spoiler!
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
Change
To
Code: Select all
player = players;
Code: Select all
player = players[i];
-
- Member
- Posts: 17
- Joined: 4 years ago
- Location: Romania
- Contact:
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();
}
}
}
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
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();
}
}
}
-
- Member
- Posts: 17
- Joined: 4 years ago
- Location: Romania
- Contact:
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 */
/* 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();
}
}
}
Ty for Break / Button Info <3
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
Sign in
Who is online
Users browsing this forum: No registered users and 2 guests