Raised This Month: $ Target: $400
 0% 

Help with gag/mute player plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Baafen
New Member
Join Date: Aug 2009
Old 08-23-2009 , 19:49   Help with gag/mute player plugin
Reply With Quote #1

Im new to scripting for amxx but not totaly new to programming/scripting.
I want to try to make a plugin that gags the player so he or she canīt use the chat or team chat.

I have found plugins that already does this so I tried to learn from them. But there is a part I donīt really understand.

Code:
public block_gagged(id){  // This function is what check the say / team_say messages & block them if the client is blocked.
    if(!g_GagPlayers[id]) return PLUGIN_CONTINUE // Is true if the client is NOT blocked.
    new cmd[5] 
    read_argv(0,cmd,4) 
    if ( cmd[3] == '_' )
        { 
        if (g_GagPlayers[id] & 2){ 
#if GagReason == 1
            client_print(id,print_chat,"* You are Gagged For The Following Reason: %s",gs_GagReason[id]) 
#else
            client_print(id,print_chat,"* You Have Been Gagged") 
#endif

#if PlaySound == 1
            client_cmd(id,"spk barney/youtalkmuch")
#endif
            return PLUGIN_HANDLED 
            } 
        } 
    else if (g_GagPlayers[id] & 1)   { 
#if GagReason == 1
            client_print(id,print_chat,"* You Are Gagged For The Following Reason: %s",gs_GagReason[id]) 
#else
            client_print(id,print_chat,"* You Have Been Gagged") 
#endif
#if PlaySound == 1
            client_cmd(id,"spk barney/youtalkmuch")
#endif
        return PLUGIN_HANDLED 
        } 
    return PLUGIN_CONTINUE 
    } 
(Taken from : http://forums.alliedmods.net/showpos...&postcount=271 )

This part is suposed to block the player when the player says something. But I donīt really get how this part actully blocks the player. Only that it tells the player that heīs gaged. Can someone please tell me if Im looking at the wrong part or if Im missing to se something.



Question two is that I also wounder which way is the best to save the gaged players. I have found nVault which seems to be able to do this. But how will it effect the server if it has to do lots of writing?

The way I want my plugin to work is that when a admin gags a player the plugin remeber the player by heīs steam id so he canīt change name to get away. And that it also saves the gag until an admin removes it. So the plugin has to remember the steam id after map changes and etc until its removed.

If there is any questions with what I mean please ask and I will try to explain it better.

And the reason why Im asking is becasue I want to learn. So please donīt tell me to use someone eles plugin. I want to learn by making my own.
Baafen is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-23-2009 , 22:57   Re: Help with gag/mute player plugin
Reply With Quote #2

Code:
return PLUGIN_HANDLED
This says that we are finished with the command ("say" or "say_team" in your case) so don't send it further (to the server to be processed as normal).

Code:
return PLUGIN_CONTINUE
This says that we are finished with the command but send it through so it will be processed normally.

You should use the former when the player is gagged.
__________________
fysiks is offline
Baafen
New Member
Join Date: Aug 2009
Old 08-24-2009 , 11:51   Re: Help with gag/mute player plugin
Reply With Quote #3

Thanks. Now I know how to block the chat.

But Im still unsure of which way is the best to actully store the blocked steamids. Should I hold the steamids in a array or should I use nVault and compared to that data everytime someone type something? Because that sounds like it would be a ineffective way compared to saving it in a 2d array and use nVault before map change.
Baafen is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-24-2009 , 18:27   Re: Help with gag/mute player plugin
Reply With Quote #4

Well, when you store the SteamID you would check on every client connect if they are in the list. Then if they are in the list set a variable (isGagged[id] = true) and then in your gagging condintion you would check if that variable is true. This way you are not accessing nVault more often than necessary.
__________________
fysiks is offline
Baafen
New Member
Join Date: Aug 2009
Old 08-28-2009 , 10:53   Re: Help with gag/mute player plugin
Reply With Quote #5

Thanks, I got it to work now and it works great!.

Now I also want to remove the change name message. Because players can chat by changeing name. Im able to change back the name itself but you still see the change name message. So they can still chat by using that. How do I prevent this message from appering?

In my plugin I used client_infochanged and in there I check if the player is gagged and use set_user_info to change the name back. But this still shows a change name message with the name the player tried to change to.

So its the message telling that someone changed his name is what I want to remove.

Im still doing some researching but I havenīt been able to really find what Im looking for.
Baafen is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-28-2009 , 19:06   Re: Help with gag/mute player plugin
Reply With Quote #6

Them changing their name should have no affect on this plugin. They shouldn't be referenced by name in the plugin, only entity number.
__________________
fysiks 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 14:58.


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