AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Block message when someone types ff in chat (https://forums.alliedmods.net/showthread.php?t=320104)

Watermelonnable 12-04-2019 11:27

Block message when someone types ff in chat
 
Hello guys.

I want to block the message that appears when someone types "ff" in the chat (Friendly fire: on/off) because smart players of the mode I'm working on exploit this to tell the alive players who's the enemy.

I thought this would be enough but it didn't work.

PHP Code:

#include <amxmodx>

#define PLUGIN            "TTT - Block FF Command"
#define VERSION            "1.0"
#define AUTHOR          "Watermelonnable"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say ff""BlockFF");
    
register_clcmd("say_team ff""BlockFF")
}

public 
BlockFF()
{
    return 
PLUGIN_HANDLED_MAIN;


Any hint to achieve this? Thank you!

DarthMan 12-04-2019 11:46

Re: Block message when someone types ff in chat
 
Quote:

Originally Posted by Watermelonnable (Post 2675661)
Hello guys.

I want to block the message that appears when someone types "ff" in the chat (Friendly fire: on/off) because smart players of the mode I'm working on exploit this to tell the alive players who's the enemy.

I thought this would be enough but it didn't work.

PHP Code:

#include <amxmodx>

#define PLUGIN            "TTT - Block FF Command"
#define VERSION            "1.0"
#define AUTHOR          "Watermelonnable"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say ff""BlockFF");
    
register_clcmd("say_team ff""BlockFF")
}

public 
BlockFF()
{
    return 
PLUGIN_HANDLED_MAIN;


Any hint to achieve this? Thank you!

In nexstmap.sma look for register_clcmd("say ff" and remove it and it's code.
Or you can use Orpheu and hook pfnClientCommand then block it by checking the arguments if they match ^say ff^ if you want to be resistent on AMXX updates without having to edit that plug-in.

Watermelonnable 12-04-2019 12:09

Re: Block message when someone types ff in chat
 
Thank you. I wanted to do the fix with orpheu but I know nothing about it so I went with the first solution :)

DarthMan 12-04-2019 14:25

Re: Block message when someone types ff in chat
 
Quote:

Originally Posted by Watermelonnable (Post 2675664)
Thank you. I wanted to do the fix with orpheu but I know nothing about it so I went with the first solution :)

There are tutorials about Orpheu.
Read, read, read, learn, learn, learn and search, search, search before asking how.
Everything you will need you can find on this forum.

OciXCrom 12-04-2019 15:45

Re: Block message when someone types ff in chat
 
There's no need to use Orpheu for such a simple thing, it's overkill. The method you used works just fine. You can also catch the message itself and block it, but there's really no need to.

HamletEagle 12-05-2019 08:41

Re: Block message when someone types ff in chat
 
pfnClientCommand can be hooked with fakemeta.
As a general rule however:fakemeta will not catch functions called by plugins, only calls from gamedll.

DarthMan 12-05-2019 11:38

Re: Block message when someone types ff in chat
 
Quote:

Originally Posted by HamletEagle (Post 2675772)
pfnClientCommand can be hooked with fakemeta.
As a general rule however:fakemeta will not catch functions called by plugins, only calls from gamedll.

That's the point. He can't use Fakemeta in this case, Orpheu remains the better alternative.
But sure, for such a plug-in, it may not be needed.

fysiks 12-05-2019 21:06

Re: Block message when someone types ff in chat
 
Occam's razor. Don't make it more complicated that it needs to be. Just edit nextmap.sma and recompile. If you don't like that, the plugin that you posted will work as long as it is listed before any plugins that also hook that message.


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

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