Raised This Month: $51 Target: $400
 12% 

[solved] disable client_print for me


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-27-2016 , 03:37   [solved] disable client_print for me
Reply With Quote #1

Read code Thanks.
PHP Code:

#include < amxmodx >

new bool:off[33];

public 
plugin_init()
{
    
register_clcmd("say /test","show_result");
    
register_clcmd("say /off","off_the_toggle");
}
public 
client_putinserver(id)
{
   
off[id] = true;
}

public 
show_result(id)
{
    new 
szName[33];
    
    if(
off[id] == true)
    {
        
get_user_name(id,szName,charsmax(szName));
         
// this will print whoever will say /test and his name to everyone
        
client_print(0,print_chat,"%s, Hey its a alliedmodders",szName);
     }
      
}

public 
off_the_toggle(id)
{
  
//i have disabled using /off and i dont want to see other players of client_print including mine
  //but still its printing is there any way to disable print for me only and other players will able to see other player msg
  //as bool is working for (id) print only is there any way to disable (0) print
  
off[id] = false;

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 12-27-2016 at 08:51.
indraraj striker is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2016 , 04:10   Re: disable client_print for me
Reply With Quote #2

Loop all players and check the bool before printing.
__________________
HamletEagle is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-27-2016 , 06:31   Re: disable client_print for me
Reply With Quote #3

now printing my msg times*playersnum suppose 10 players then spamming 10 times same msg

PHP Code:

#include < amxmodx > 

#define MAX_PLAYERS 32

new bool:off[33]; 

public 
plugin_init() 

    
register_clcmd("say /test","show_result"); 
    
register_clcmd("say /off","off_the_toggle"); 

public 
client_putinserver(id

   
off[id] = true
   
set_task(10.0,"say_command",id);


public 
say_command(id)
{
client_cmd(id,"say /test");
}

public 
show_result(id

    new 
szName[33]; 
    new 
Players[MAX_PLAYERS], PlayerCount;
    
get_playersPlayersPlayerCount);
   
   for( new 
i=0PlayerCounti++ )
    {
      if(
off[id] == true
    {
        
get_user_name(id,szName,charsmax(szName)); 
        
//now printing my name times*playersnum suppose 10 players then my name is spamming 10times same msg
        
client_print(0,print_chat,"%s, Hey its a alliedmodders",szName); 
     }
   }     


public 
off_the_toggle(id

  
off[id] = false

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 12-27-2016 at 06:31.
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-27-2016 , 06:42   Re: disable client_print for me
Reply With Quote #4

what are you trying to do ?
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-27-2016 , 07:43   Re: disable client_print for me
Reply With Quote #5

Toggle client_print which index has 0 - everyone
as bool is working with when we have index id
suppose i m having some function which will print user name xyz msg using /test

This is me : say /test it will print indra how are you ? index - 0 - so everyone can see this msg
suppose now you said /test it will print Craxor how are you ? index - 0 - so everyone can see this msg

Now if i said /off bool will be false
and your msg will not see to me but other can see your msg Craxor how are you ?
and also please read my code i have commented code
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 12-27-2016 at 07:43.
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-27-2016 , 08:04   Re: disable client_print for me
Reply With Quote #6

PHP Code:
public show_result(id

    new 
szName[MAX_PLAYERS]; 
    new 
Players[MAX_PLAYERS], PlayerCount;

    
get_playersPlayersPlayerCount);
   
    for( new 
i=0PlayerCounti++ )
    {
      if(
off[Players[i]]) 
      {
        
get_user_name(Players[i],szName,charsmax(szName)); 
        
client_print(Players[i],print_chat,"%s, Hey its a alliedmodders",szName); 
     }
   }     

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-27-2016 , 08:11   Re: disable client_print for me
Reply With Quote #7

Here is example
what i m trying to do when i said /hudoff it should be hide for me but other player can see this hud msg even index 0

In the first code bool wont work as index 0 - to everyone still it will show to you if you set bool true/false
PHP Code:

#include < amxmodx >

public client_putinserver(id)
{
  
set_task(50.0,"show_output",id ,_,_"b");
}

public 
show_output(id)
{
    
// now this msg will repeat after 50 sec and show to everyone
    // now if i said /hudoff it should hide for me but other can see this msg i would like to know the way
   //bool does not work in this condtion     
   
set_hudmessage(255000.320.4006.012.0);
   
show_hudmessage(0"Welcome to alliedmodders");

second code will work as index of hud is id - to me

PHP Code:

#include <amxmodx>

new bool:hudon[33]

public 
plugin_init()
{
   
register_clcmd("say /hudoff","disable_hud");
}

public 
client_putinserver(id)
{
 
set_task(50.0,"show_output",id ,_,_"b");
 
hudon[id]= true;
}

public 
show_output(id)
{
    
// now this msg will repeat after 50 sec to me id<-------
    
if(hudon[id] == true)
   {
   
set_hudmessage(255000.320.4006.012.0);
   
show_hudmessage(id "Welcome to alliedmodders");
   }
}

public 
disable_hud(id)
{
 
hudon[id] = false;

__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-27-2016 , 08:41   Re: disable client_print for me
Reply With Quote #8

try this:
PHP Code:
#include <amxmodx>

new bool:Show[33];

public 
plugin_init( )
{
    
register_clcmd"say .toggle""togglecmd" );
    
register_clcmd"say /show" "showcmd" );
}

public 
togglecmdid )
{
    
Showid ] = !Showid ];

    
client_printid print_chat, !Showid ] ? "You won't see the message" "You will se the message now" );
    return 
PLUGIN_HANDLED;
}

public 
showcmdid )
{
    new 
Players[32], NumszName[32];
    
get_playersPlayersNum );

    for( new 
Num i++ )
    {
        if( 
ShowPlayers[i] ] )
        {
            
get_user_namePlayers], szNamecharsmaxszName ) );
            
client_printPlayers[i], print_chat"Heloo %s, you see this message"szName );
        }
    }

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 12-27-2016 , 08:48   Re: disable client_print for me
Reply With Quote #9

Craxor Thanks a lot bruh (Y) so quick
Solved.
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2016 , 09:02   Re: [solved] disable client_print for me
Reply With Quote #10

I simply don't get why people refuse to think before doing something. What's the point in putting the client_print inside a loop if you are still using 0 as index? You send to everyone, so it's expected that it will be send multiple times. Instead, you should send only to one player(that's why you loop all indexes).
__________________
HamletEagle is offline
Old 12-27-2016, 09:06
Craxor
This message has been deleted by Craxor. Reason: fawf2f12fa
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 20:20.


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