Raised This Month: $32 Target: $400
 8% 

Stock to print only in Admin Chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ComedyShotsGamer
Senior Member
Join Date: Mar 2016
Old 06-12-2016 , 13:17   Stock to print only in Admin Chat
Reply With Quote #1

PHP Code:
stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if(id)
        
players[0] = id;
    else
        
get_players(playerscount"ch");
    
    for (new 
0counti++)
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
        
write_byte(players[i]);
        
write_string(msg);
        
message_end();
    }

I have this stock for printing in Chat but i need it to print only in Admin Chat!
ComedyShotsGamer is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-12-2016 , 13:19   Re: Stock to print only in Admin Chat
Reply With Quote #2

A quick way to do it is to add a check in your loop to see if the player is an admin. is_user_admin()
__________________
fysiks is offline
ComedyShotsGamer
Senior Member
Join Date: Mar 2016
Old 06-12-2016 , 13:24   Re: Stock to print only in Admin Chat
Reply With Quote #3

Im not good in Scripting...How?
ComedyShotsGamer is offline
crnova
Senior Member
Join Date: Sep 2015
Old 06-12-2016 , 15:06   Re: Stock to print only in Admin Chat
Reply With Quote #4

Code:
for (new i = 0; i < count; i++) {         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);         write_byte(players[i]);         write_string(msg);         message_end(); }

->

Code:
for (new i = 0; i < count; i++) {         if( is_user_admin(id) )         {                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);                 write_byte(players[i]);                 write_string(msg);                 message_end();         } }
__________________
crnova is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-12-2016 , 15:16   Re: Stock to print only in Admin Chat
Reply With Quote #5

Use:
color_print(1, 0, "Message printed only to Admins")

Stock:
PHP Code:
stock color_print(admin=0,const id,const input[],any:...){
    new 
count 1,players[32]
    new 
msg[191]
    
vformat(msg,190,input,4)
    
replace_all(msg,190,"!g","^4")
    
replace_all(msg,190,"!y","^1")
    
replace_all(msg,190,"!team","^3")
    if(
idplayers[0] = id; else get_players(players,count,"ch");{
        for(new 
i=0counti++){
            if(
is_user_connected(players[i])){
                if(
admin==&& !is_user_admin(players[i]))
                    continue;
                
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i])  
                
write_byte(players[i])
                
write_string(msg)
                
message_end()
            }
        }
    }


Last edited by siriusmd99; 06-12-2016 at 15:17.
siriusmd99 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 04:49.


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