AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_print only to admins (https://forums.alliedmods.net/showthread.php?t=101377)

matiaslp 08-23-2009 10:02

client_print only to admins
 
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!

fysiks 08-23-2009 13:14

Re: client_print only to admins
 
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.

BOYSplayCS 08-23-2009 13:33

Re: client_print only to admins
 
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.

AntiBots 08-23-2009 15:31

Re: client_print only to admins
 
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;



matiaslp 08-23-2009 17:23

Re: client_print only to admins
 
thanks!

One 08-23-2009 18:10

Re: client_print only to admins
 
why getmaxplayers?

why not just:
PHP Code:

if(is_user_admin(id)
{
client_print(id,print_chat,"haha")



Bugsy 08-23-2009 19:12

Re: client_print only to admins
 
Quote:

Originally Posted by One (Post 910643)
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.

One 08-23-2009 20:04

Re: client_print only to admins
 
whats about if_is_admin(0) ? will this work ?

Bugsy 08-23-2009 20:20

Re: client_print only to admins
 
Quote:

Originally Posted by One (Post 910801)
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.


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

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