AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved block teamattack message (https://forums.alliedmods.net/showthread.php?t=335837)

The overrated maniac 01-07-2022 16:22

block teamattack message
 
For a jailbreak mod, when a terrorist attack another terrorist, the message on say says "x attacked a teammate" I want to remove it. I tryed this

PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("D7 block saytext team attack""0.0.1""D i 5 7 i n c T, Johnny got his gun")
    
    
register_message(get_user_msgid("SayText"), "message_SayText")
}

// Credits to Johnny got his gun
public message_SayText()
{
    if (
get_msg_args() > 4)
        return 
PLUGIN_CONTINUE;
    
    static 
szBuffer[40];
    
get_msg_arg_string(2szBuffer39)
    
    if (!
equali(szBuffer"#Cstrike_TitlesTXT_Game_teammate_attack"))
        return 
PLUGIN_CONTINUE;
    
    return 
PLUGIN_HANDLED;


and this (with the plugin init obv)

PHP Code:

public message_SayText()
{
    if (
get_msg_args() > 4)
        return 
PLUGIN_CONTINUE;
    
    static 
szBuffer[23];
    
get_msg_arg_string(2szBuffer22)
    
    if (!
equali(szBuffer"#C4_Plant_At_Bomb_Spot") )
    {
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_HANDLED;


They dont work and I checked jbextreme and no idea how he does it.
Post from the functions: https://forums.alliedmods.net/showth...20#post2180920
Post from jbextreme: https://forums.alliedmods.net/showthread.php?p=1113644
Example image from the text to remove: https://i.imgur.com/xe9FpcF.png

OciXCrom 01-07-2022 17:28

Re: block teamattack message
 
Remove "Cstrike_TitlesTXT_" from the first code.
The message code is "#Game_teammate_attack".

You can also use my plugin to modify/block any message - https://forums.alliedmods.net/showthread.php?t=282218
You can get a full list of messages in resource/cstrike_english.txt. Again, the "Cstrike_TitlesTXT_" part needs to be ommited.

The overrated maniac 01-07-2022 18:09

Re: block teamattack message
 
Quote:

Originally Posted by OciXCrom (Post 2767916)
Remove "Cstrike_TitlesTXT_" from the first code.
The message code is "#Game_teammate_attack".

You can also use my plugin to modify/block any message - https://forums.alliedmods.net/showthread.php?t=282218
You can get a full list of messages in resource/cstrike_english.txt. Again, the "Cstrike_TitlesTXT_" part needs to be ommited.


still not working:
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("D7 block saytext team attack""0.0.1""D i 5 7 i n c T, Johnny got his gun")
    
    
register_message(get_user_msgid("SayText"), "message_SayText")
}

// Credits to Johnny got his gun
public message_SayText()
{
    if (
get_msg_args() > 4)
        return 
PLUGIN_CONTINUE;
    
    static 
szBuffer[40];
    
get_msg_arg_string(2szBuffer39)
    
    if (!
equali(szBuffer"#Game_teammate_attack"))
        return 
PLUGIN_CONTINUE;
    
    return 
PLUGIN_HANDLED;


The message in cstrike_english.txt is Cstrike_TitlesTXT_Game_teammate_attack

I dont like to use a plugin like that only for block 1 message, but if its the only way, I will

CrazY. 01-07-2022 18:33

Re: block teamattack message
 
It isn't SayText, it is TextMsg.

https://github.com/s1lentq/ReGameDLL...ayer.cpp#L1072
https://github.com/s1lentq/ReGameDLL.../util.cpp#L660

Code:
#include <amxmodx> public plugin_init() {     register_plugin("D7 block saytext team attack", "0.0.1", "D i 5 7 i n c T, Johnny got his gun")         register_message(get_user_msgid("TextMsg"), "message_TextMsg") } // Credits to Johnny got his gun public message_TextMsg() {     new szBuffer[40];     get_msg_arg_string(2, szBuffer, 39)         if (!equali(szBuffer, "#Game_teammate_attack"))         return PLUGIN_CONTINUE;         return PLUGIN_HANDLED; }

The overrated maniac 01-07-2022 18:54

Re: block teamattack message
 
Quote:

Originally Posted by CrazY. (Post 2767923)
It isn't SayText, it is TextMsg.

https://github.com/s1lentq/ReGameDLL...ayer.cpp#L1072
https://github.com/s1lentq/ReGameDLL.../util.cpp#L660

Code:
#include <amxmodx> public plugin_init() {     register_plugin("D7 block saytext team attack", "0.0.1", "D i 5 7 i n c T, Johnny got his gun")         register_message(get_user_msgid("TextMsg"), "message_TextMsg") } // Credits to Johnny got his gun public message_TextMsg() {     new szBuffer[40];     get_msg_arg_string(2, szBuffer, 39)         if (!equali(szBuffer, "#Game_teammate_attack"))         return PLUGIN_CONTINUE;         return PLUGIN_HANDLED; }

Thanks, it worked

sb123 01-08-2022 00:23

Re: block teamattack message
 
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin(...)
    
set_msg_block(get_user_msgid("TextMsg"), BLOCK_SET)



Natsheh 01-08-2022 06:07

Re: block teamattack message
 
Quote:

Originally Posted by sb123 (Post 2767935)
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin(...)
    
set_msg_block(get_user_msgid("TextMsg"), BLOCK_SET)



This will block all the Text messages that are sent to the client which is not what the OP wants.

sb123 01-08-2022 06:45

Re: block teamattack message
 
PHP Code:

/* Copyright by KaLoSZyFeR */

#include <amxmodx>

#define PLUGIN "Block Messages"
#define VERSION "0.1"
#define AUTHOR "KaLoSZyFeR"

#define AMOUNT 128        // amount of texts in tables or something (I don't know how it is in english)



public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("TextMsg"), "message")
}

new 
text[AMOUNT][] = {
    
"#Target_Bombed",
    
"#VIP_Escaped",
    
"#VIP_Assassinated",
    
"#Terrorists_Escaped",
    
"#CTs_PreventEscape",
    
"#Escaping_Terrorists_Neutralized",
    
"#Bomb_Defused",
    
"#CTs_Win",
    
"#Terrorists_Win",
    
"#Round_Draw",
    
"#All_Hostages_Rescued",
    
"#Target_Saved",
    
"#Hostages_Not_Rescued",
    
"#Terrorists_Not_Escaped",
    
"#VIP_Not_Escaped",
    
"#Cannot_Buy_This",
    
"#Not_Enough_Money",
    
"#Weapon_Not_Available",
    
"#Already_Have_Kevlar",
    
"#Already_Have_Kevlar_Helmet",
    
"#Already_Have_Kevlar_Bought_Helmet",
    
"#Already_Have_Helmet_Bought_Kevlar",
    
"#Cannot_Carry_Anymore",
    
"#Already_Have_One",
    
"#Cannot_Switch_From_VIP",
    
"#All_Teams_Full",
    
"#Terrorists_Full",
    
"#CTs_Full",
    
"#Too_Many_Terrorists",
    
"#Too_Many_CTs",
    
"#Wait_3_Seconds",
    
"#Only_1_Team_Change",
    
"#Ignore_Broadcast_Messages",
    
"#Ignore_Broadcast_Team_Messages",
    
"#Accept_All_Messages",
    
"#Ignore_Radio",
    
"#Accept_Radio",
    
"#Command_Not_Available",
    
"#Defusing_Bomb_With_Defuse_Kit",
    
"#Defusing_Bomb_Without_Defuse_Kit",
    
"#Killed_Hostage",
    
"#Injured_Hostage",
    
"#Auto_Team_Balance_Next_Round",
    
"#All_VIP_Slots_Full",
    
"#Killed_Teammate",
    
"#Banned_For_Killing_Teammates",
    
"#Cannot_Vote_Map",
    
"#Weapon_Cannot_Be_Dropped",
    
"#Terrorist_Escaped",
    
"#C4_Plant_At_Bomb_Spot",
    
"#C4_Plant_Must_Be_On_Ground",
    
"#C4_Arming_Cancelled",
    
"#Bomb_Planted",
    
"#C4_Activated_At_Bomb_Spot",
    
"#Switch_To_BurstFire",
    
"#Switch_To_SemiAuto",
    
"#Switch_To_FullAuto",    /* TUTAJ KONIEC */
    
"#GAMESAVED",
    
"#Game_Commencing",
    
"#Game_connected",
    
"#Game_disconnected",
    
"#Game_join_terrorist",
    
"#Game_join_ct",
    
"#Game_join_terrorist_auto",
    
"#Game_join_ct_auto",
    
"#Game_scoring",
    
"#Game_idle_kick",
    
"#Game_bomb_drop",
    
"#Game_bomb_pickup",
    
"#Game_no_timelimit",
    
"#Game_timelimit",
    
"#Game_unknown_command",
    
"#Game_in_position",
    
"#Game_added_position",
    
"#Game_teammate_kills",
    
"#Game_required_votes",
    
"#Game_teammate_attack",
    
"#Game_kicked",
    
"#Game_vote_cast",
    
"#Game_vote_usage",
    
"#Game_vote_player_not_found",
    
"#Game_vote_players_on_your_team",
    
"#Game_vote_not_yourself",
    
"#Game_voted_for_map",
    
"#Game_votemap_usage",
    
"#Cannot_Vote_Need_More_People",
    
"#Map_Vote_Extend",
    
"#Cannot_Vote_With_Less_Than_Three",
    
"#Game_will_restart_in",    /* TUTAJ KONIEC DRUGIEJ CZESCI */
    
"#Cant_buy",
    
"#VIP_cant_buy",
    
"#CT_cant_buy",
    
"#Terrorist_cant_buy",
    
"#Vote",
    
"#Votes",    /* TUTAJ KONIEC TRZECIEJ CZESCI */
    
"#Got_defuser",
    
"#Got_bomb",
    
"#Cannot_Be_Spectator",
    
"#Muted",
    
"#Unmuted",
    
"#No_longer_hear_that_player",
    
"#Name_change_at_respawn",
    
"#C4_Defuse_Must_Be_On_Ground",
    
"#Spec_Mode1",
    
"#Spec_Mode2",
    
"#Spec_Mode3",
    
"#Spec_Mode4",
    
"#Spec_Mode5",
    
"#Spec_Mode6",
    
"#Spec_NoTarget",
    
"#Spec_Help_Title",
    
"#Spec_Slow_Motion",
    
"#Spec_Replay",
    
"#Spec_Auto",
    
"#Spec_Time",
    
"#Spec_Map",
    
"#Spectators",
    
"#Unassigned",
    
"#Only_CT_Can_Move_Hostages",
    
"#Spec_Duck",
    
"#Spec_Not_Valid_Choice",
    
"#Spec_Not_In_Spectator_Mode",
    
"#Spec_NoPlayers",
    
"#Spec_ListPlayers",
    
"#Selection_Not_Available",
    
"#Alias_Not_Avail",
    
"#Spec_No_PIP",
    
"#Cstrike_Already_Own_Weapon"
}

public 
message()
{
    if(
get_msg_argtype(2) != ARG_STRING)
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
arg2[32]
    
get_msg_arg_string(2arg231)    
    
    if(
get_msg_args() == )
    {
        new 
arg3[20],arg4[20]
        
get_msg_arg_string(3arg319)
        
get_msg_arg_string(4arg419)
        
        for(new 
0AMOUNTi++)
        {
            if(
equal(arg2text[i]))
            {
                return 
PLUGIN_HANDLED
            
}
        }
    }    
    else if(
get_msg_args() == )
    {
        new 
arg3[20]
        
get_msg_arg_string(3arg319)
        
        for(new 
0AMOUNTi++)
        {
            if(
equal(arg2text[i]))
            {
                
                return 
PLUGIN_HANDLED
            
}
        }
    }    
    else
    {
        for(new 
0AMOUNTi++)
        {
            if(
equal(arg2text[i]))
            {
                
                return 
PLUGIN_HANDLED
            
}
        }
    }
    return 
PLUGIN_CONTINUE



OciXCrom 01-08-2022 07:40

Re: block teamattack message
 
Quote:

Originally Posted by Natsheh (Post 2767955)
This will block all the Text messages that are sent to the client which is not what the OP wants.


iceeedr 01-08-2022 10:57

Re: block teamattack message
 
Quote:

Originally Posted by sb123 (Post 2767956)
[PHP]/* Copyright by KaLoSZyFeR */

Quote:

Originally Posted by fysiks (Post 2707743)
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.



All times are GMT -4. The time now is 11:32.

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