Solved Button Info

Unpaid Requests, Public Plugins
Post Reply
User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

Button Info

#1

Post by sPe3doN » 5 years ago

Can someone change this to show only For admin
Only admin who can see who use the button

Code: Select all

#include <zombie_escape>

#define PLUGIN    "Button Info"
#define AUTHOR    "SeRious_SaM"
#define VERSION    "1.0"


public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
    RegisterHam(Ham_Use,"func_button","fwButtonUsed",1)
}

	
public fwButtonUsed( ent, idcaller )
	{
		new szName[33];
		get_user_name( idcaller, szName, charsmax( szName ) );
		ze_colored_print( 0, "!y****%s Pressed the button****", szName );
	}

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

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

#2

Post by Night Fury » 5 years ago

Make a loop show message to who is admin by checking whether he's admin or nah using this natives:

Code: Select all

is_user_admin(index)
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

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

#3

Post by Raheem » 5 years ago

Here what jack said:
  • Code: Select all

    #include <zombie_escape>
    #include <amxmisc>
    
    #define PLUGIN    "Button Info"
    #define AUTHOR    "SeRious_SaM"
    #define VERSION    "1.0"
    
    new g_iMaxPlayers
    
    public plugin_init()
    {
    	register_plugin(PLUGIN, VERSION, AUTHOR)
        RegisterHam(Ham_Use,"func_button","fwButtonUsed",1)
    	
    	g_iMaxPlayers = get_member_game(m_nMaxPlayers)
    }
    	
    public fwButtonUsed( ent, idcaller )
    {
    	for(new id = 1; id <= g_iMaxPlayers; id++)
    	{
    		if (!is_user_admin(id))
    			continue;
    		
    		new szName[33];
    		get_user_name( idcaller, szName, charsmax( szName ) );
    		ze_colored_print( id, "!y****!g%s !tPressed the button!y****", szName );
    	}
    }
He who fails to plan is planning to fail

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: Bing [Bot] and 2 guests