AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove StatusText (https://forums.alliedmods.net/showthread.php?t=92189)

shine771 05-11-2009 13:24

Remove StatusText
 
Hello, is it possible to remove StatusText after it's set manually? Like:
PHP Code:

    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusText,_,id)
    
write_byte(0)
    
write_string("Hello")
    
message_end() 

I tried:
PHP Code:

    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusText,_,id)
    
write_byte(0)
    
write_string("")
    
message_end() 

Aiming on teammates doesn't work anymore(until round end). Maybe i have to set StatusValue to something to remove it properly?

ConnorMcLeod 05-11-2009 13:31

Re: Remove StatusText
 
Just send a StatusValue msg with arg1 = 1 and arg2 = 0

xPaw 05-11-2009 13:34

Re: Remove StatusText
 
PHP Code:

    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusText,_,id)
    
write_byte(0)
    
write_string(" ")
    
message_end() 


Arkshine 05-11-2009 13:35

Re: Remove StatusText
 
Yeah you have to play with StatusValue. Both works together.

[Edit] Wow. I'm too slow.

shine771 05-11-2009 13:59

Re: Remove StatusText
 
@Connor - Doesn't work
@xPaw - I think you didn't understand. I can get rid of that message, but when i look at teammates, it doesn't show their names anymore.
@Arkshine - I tried, alot, no success.

Help.

hleV 05-11-2009 16:17

Re: Remove StatusText
 
Check if this works.
Code:
#include <amxmodx>   public plugin_init() {         register_plugin("Remove Custom StatusText", "1.0", "hleV");         register_message(get_user_msgid("StatusText"), "StatusTextMessage"); }   public StatusTextMessage() {         static ArgumentString[16];         get_msg_arg_string(2, ArgumentString, 15);           if (contain(ArgumentString, "%c1") == -1) // Also try "%p2"                 set_msg_arg_string(2, ""); }

ConnorMcLeod 05-11-2009 16:39

Re: Remove StatusText
 
Quote:

Originally Posted by shine771 (Post 825681)
@Connor - Doesn't work

I'm using this in client_prethink and it works as expected (both StatusValue and StatusText are BLOCK_SET):
PHP Code:

    static iPlayercrap
    get_user_aiming
(idiPlayercrap)
    if( 
Is_PlayeriPlayer ) )
    {
        static 
iOldPlayer
        iOldPlayer 
g_iTarget[id]

        if( !
iOldPlayer )
        {
            
message_begin(MSG_ONE_UNRELIABLEgmsgStatusValue_id)
            
write_byte(1)
            
write_short(2)
            
message_end()
        }

        if( 
iOldPlayer != iPlayer )
        {
            
g_iTarget[id] = iPlayer
            message_begin
(MSG_ONE_UNRELIABLEgmsgStatusValue_id)
            
write_byte(2)
            
write_short(iPlayer)
            
message_end()
        }

        if( !
iOldPlayer )
        {
            static const 
szStatusText[] = "1 %p2"
            
message_begin(MSG_ONE_UNRELIABLEgmsgStatusText_id)
            
write_byte(0)
            
write_string(szStatusText)
            
message_end()
        }
    }
    else
    {
        if( 
g_iTarget[id] )
        {
            
g_iResetStatusText[id] = 100
            g_iTarget
[id] = 0
            
        
}
        else if( --
g_iResetStatusText[id] == )
        {
            
message_begin(MSG_ONE_UNRELIABLEgmsgStatusValue_id)
            
write_byte(1)
            
write_short(0)
            
message_end()
        }
    } 


Exolent[jNr] 05-11-2009 18:20

Re: Remove StatusText
 
Quote:

Originally Posted by ConnorMcLeod (Post 825791)
I'm using this in client_prethink and it works as expected (both StatusValue and StatusText are BLOCK_SET):

So you're saying that this works?
PHP Code:

new g_msgStatusText;
new 
g_msgStatusValue;

new 
g_MaxPlayers;

public 
plugin_init()
{
    
register_forward(FM_PlayerPreThink"fwdPlayerPreThink"0);
    
    
g_msgStatusText get_user_msgid("StatusText");
    
g_msgStatusValue get_user_msgid("StatusValue");
    
    
set_msg_block(g_msgStatusTextBLOCK_SET);
    
set_msg_block(g_msgStatusValueBLOCK_SET);
    
    
g_MaxPlayers global_get(glb_maxClients);
}

public 
fwdPlayerPreThink(plr)
{
    if( 
is_user_alive(plr) )
    {
        static 
old_target[33];
        static 
reset[33];
        
        new 
targetbody;
        
get_user_aiming(plrtargetbody9999);
        
        if( 
target <= g_MaxPlayers && is_user_alive(target) )
        {
            new 
old old_target[plr];
            
            if( !
old )
            {
                
message_begin(MSG_ONE_UNRELIABLEg_msgStatusValue_plr);
                
write_byte(1);
                
write_short((((!!(cs_get_user_team(plr) == cs_get_user_team(target))) + 1) % 2) + 1);
                
message_end();
            }
            
            if( 
old != target )
            {
                
old_target[plr] = target;
                
message_begin(MSG_ONE_UNRELIABLEg_msgStatusValue_plr);
                
write_byte(2);
                
write_short(target);
                
message_end();
            }
            
            if( !
old )
            {
                
message_begin(MSG_ONE_UNRELIABLEg_msgStatusText_plr);
                
write_byte(0);
                
write_string("1 %p2");
                
message_end();
            }
        }
        else
        {
            if( 
old_target[plr] )
            {
                
reset[plr] = 100;
                
old_target[plr] = 0;
            }
            else if( 
reset[plr] > && --reset[plr] == )
            {
                
message_begin(MSG_ONE_UNRELIABLEg_msgStatusValue_plr);
                
write_byte(1);
                
write_short(0);
                
message_end();
            }
        }
    }



ConnorMcLeod 05-11-2009 18:33

Re: Remove StatusText
 
In fact i was wrong, i don't block msgs, but code works fine.
The game don't send messages with skyjur semiclip method.

HL set all this stuff in UpdateClientData.

shine771 05-12-2009 14:58

Re: Remove StatusText
 
Isn't there a less resource eating way? Without hooking prethink and checking aiming? A magic combination of those 2 messages that would make player names displayed again? That's the only thing i need, cause after sending StatusText player names aren't displayed anymore. I don't want to recreate the aim - show info system.

Thanks.


All times are GMT -4. The time now is 01:28.

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