Raised This Month: $ Target: $400
 0% 

client_print only to admins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
matiaslp
Senior Member
Join Date: Apr 2007
Old 08-23-2009 , 10:02   client_print only to admins
Reply With Quote #1

I'm looking an answer for this stupid question but i can't find it...

actually i'm using

client_print(0, print_chat,"@ blaaa...

but maybe it's a better way of hardcoding the @

thanks!
matiaslp is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-23-2009 , 13:14   Re: client_print only to admins
Reply With Quote #2

The @ symbol does nothing. Your title and your post are completely different.

To print to only admins you need to loop through everyone and then check if they are an admin and then print to that one person.
__________________
fysiks is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-23-2009 , 13:33   Re: client_print only to admins
Reply With Quote #3

In your function, check if the user is an admin by
if (!is_user_admin(id))

That will return false (or no), so go ahead and return PLUGIN_CONTINUE; after that statement. After return PLUGIN_CONTINUE; then print the chat message.
BOYSplayCS is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-23-2009 , 15:31   Re: client_print only to admins
Reply With Quote #4

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

new g_iMaxPlayers;

public 
plugin_init() 
{
    
register_plugin("lol""1.0""ReymonARG");
    
g_iMaxPlayers get_maxplayers();
    
register_clcmd("say lala""cmdlala");
}

public 
cmdlalaid )
{
    for( new 
1<= g_iMaxPlayers i++ )
    {
        if( 
is_user_admin(i) )
        {
            
client_print(iprint_chat"You Are an Admin!!!!");
        }
    }
    
    return 
PLUGIN_HANDLED;

__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
matiaslp
Senior Member
Join Date: Apr 2007
Old 08-23-2009 , 17:23   Re: client_print only to admins
Reply With Quote #5

thanks!
matiaslp is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 08-23-2009 , 18:10   Re: client_print only to admins
Reply With Quote #6

why getmaxplayers?

why not just:
PHP Code:
if(is_user_admin(id)
{
client_print(id,print_chat,"haha")

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2009 , 19:12   Re: client_print only to admins
Reply With Quote #7

Quote:
Originally Posted by One View Post
why getmaxplayers?

why not just:
PHP Code:
if(is_user_admin(id)
{
client_print(id,print_chat,"haha")

matiaslp asked for a way to print a message to admins. Yes, your code will only print if (id) is an admin but you show no means of where id is coming from. Antibots code will loop from 1->maxplayers, printing the message to all connected admins.
__________________
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 08-23-2009 , 20:04   Re: client_print only to admins
Reply With Quote #8

whats about if_is_admin(0) ? will this work ?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2009 , 20:20   Re: client_print only to admins
Reply With Quote #9

Quote:
Originally Posted by One View Post
whats about if_is_admin(0) ? will this work ?
No, 0 is an invalid player id. Player id's range from 1 - maxplayers (max is 32). You may be thinking of how client_print works where 0 will include all players.
__________________
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode