AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Clear Chat Text (https://forums.alliedmods.net/showthread.php?t=143904)

shuttle_wave 11-26-2010 15:56

Clear Chat Text
 
How would i clear the chat text. I want to clear every message from chat at round start.

Exolent[jNr] 11-26-2010 16:04

Re: Clear Chat Text
 
You could send a SayText message with 5 blank lines "^n^n^n^n".

shuttle_wave 11-26-2010 16:05

Re: Clear Chat Text
 
ok ty.

shuttle_wave 11-26-2010 16:16

Re: Clear Chat Text
 
PHP Code:

    static szMsg[128];
    
formatex(szMsgsizeof(szMsg) - 1"^n^n^n^n");
    
    new 
iPlayers[MAX_PLAYERS], iNumplayer;
    
get_players(iPlayersiNum"a");
    
    for(new 
i<= iNumi++)
    {
        
player iPlayers[i];
        
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _player);
        
write_byte(0);
        
write_string(szMsg);
        
message_end();
    } 

something like that?

Exolent[jNr] 11-26-2010 18:19

Re: Clear Chat Text
 
1. Why format the variable when you know it's contents? Either make it constant or use copy() because there is no formatting.
2. Cache get_user_msgid("SayText") in plugin_init().
3. Don't loop through all players. Just use MSG_BROADCAST.

shuttle_wave 11-26-2010 19:33

Re: Clear Chat Text
 
Quote:

Originally Posted by Exolent[jNr] (Post 1357398)
1. Why format the variable when you know it's contents? Either make it constant or use copy() because there is no formatting.
2. Cache get_user_msgid("SayText") in plugin_init().
3. Don't loop through all players. Just use MSG_BROADCAST.

PHP Code:

#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>

// Define the Plugin Version
new const VERSION[] = "1.0";

new const 
szMsg2[] = "^n^n^n^n";

new 
g_msgClear;

public 
plugin_init()
{
    
register_plugin("Clear MSG Test"VERSION"Shuttle_Wave");

    
register_logevent("EventRoundStart",    2,    "1=Round_Start");
    
    
g_msgClear get_user_msgid("SayText");
}

public 
EventRoundStart()
{
    
message_begin(MSG_ONE_UNRELIABLEg_msgClear_MSG_BROADCAST);
    
write_byte(0);
    
write_string(szMsg2);
    
message_end();


????

Emp` 11-26-2010 19:52

Re: Clear Chat Text
 
PHP Code:

#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>

// Define the Plugin Version
new const VERSION[] = "1.0";

new 
g_msgSayText;

public 
plugin_init()
{
    
register_plugin("Clear MSG Test"VERSION"Shuttle_Wave");

    
register_logevent("EventRoundStart",    2,    "1=Round_Start");
    
    
g_msgSayText get_user_msgid("SayText");
}

public 
EventRoundStart()
{
    
message_begin(MSG_BROADCASTg_msgSayText);
    
write_byte(0);
    
write_string("^n^n^n^n");
    
message_end();



shuttle_wave 11-26-2010 20:04

Re: Clear Chat Text
 
Quote:

Originally Posted by Emp` (Post 1357467)
PHP Code:

#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>

// Define the Plugin Version
new const VERSION[] = "1.0";

new 
g_msgSayText;

public 
plugin_init()
{
    
register_plugin("Clear MSG Test"VERSION"Shuttle_Wave");

    
register_logevent("EventRoundStart",    2,    "1=Round_Start");
    
    
g_msgSayText get_user_msgid("SayText");
}

public 
EventRoundStart()
{
    
message_begin(MSG_BROADCASTg_msgSayText);
    
write_byte(0);
    
write_string("^n^n^n^n");
    
message_end();



doesnt seem to work ( clear msg from chat )

dFF 11-27-2010 02:11

Re: Clear Chat Text
 
Try to change
PHP Code:

write_string("^n^n^n^n"); 



to
PHP Code:

write_string("|"); 


hleV 11-27-2010 04:45

Re: Clear Chat Text
 
You need to provide a valid sender ID. Search for a connected player.


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

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