AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replace messages (https://forums.alliedmods.net/showthread.php?t=183895)

bazhenov93 04-28-2012 07:20

Replace messages
 
Well, i have a plugin that replace some messages like "Terrorists Win!", "The bomb has been planted!" and so.. But message like "Enemy spotted." , "Defusing bomb WITHOUT Defuse kit." , "Press the BUY key to purchase items." , "Free Chase Cam" and etc won't change..

WHY ? and How to replace this messages ? ;)

example:
PHP Code:

new const g_szOriginal[][] = {

"#CTs_Win"
"#Terrorists_Win"        
}
#define MAX_REPLACE sizeof(g_szOriginal) 

new const g_szReplace[MAX_REPLACE][] = {

"Counter-Terrorists Win!",
"Terrorists Win!"
};

enum _:RGB RG}; 

new const 
g_iColor[MAX_REPLACE][RGB] = {

{
255,    255,    255},
{
255,    255,    255}
};

new const 
g_iEffect[MAX_REPLACE] = {
0,
0
};

new const 
Float:g_fTime[MAX_REPLACE] = {

3.0,
2.0
};


new 
Trie:g_tReplacements 

#define toColor(%1) (%1 == -1 ? random(256) : %1) 
public plugin_init() {
    
    
register_message(get_user_msgid("TextMsg"), "Message_TextMsg"
    
g_tReplacements TrieCreate()
    for(new 
0MAX_REPLACEi++)
    {
    
TrieSetCell(g_tReplacementsg_szOriginal[i], i);
    }
}   
public 
Message_TextMsg(iMsgIdiMsgDestid) { 
    
    if( !
id && get_msg_arg_int(1) == print_center 
    { 
    new 
szMessage[64], index
    get_msg_arg_string
(2szMessagecharsmax(szMessage)) 
    if( 
TrieGetCell(g_tReplacementsszMessageindex) ) 
    {
    
set_dhudmessage(
        .
red      toColor(g_iColor[index][R]),
        .
green    toColor(g_iColor[index][G]),
        .
blue     toColor(g_iColor[index][B]),
        .
effects  g_iEffect[index],
        .
holdtime g_fTime[index],
        .
fxtime   g_fTime[index]
        );
    
show_dhudmessage(0g_szReplace[index]) 
    return 
PLUGIN_HANDLED 
        

    } 
    return 
PLUGIN_CONTINUE 



bazhenov93 05-13-2012 14:32

Re: Replace messages
 
bump

NiHiLaNTh 05-13-2012 14:46

Re: Replace messages
 
AFAIK you need to hook HudTextArgs message for those types of message.

P.S. Show us the new tatoo.

bazhenov93 05-13-2012 16:37

Re: Replace messages
 
Why I should post photos of my ass ?
There's one on my avatar, that does not show to much, but :oops: ..

only for my bf :*

thanks for the hudtextargs..

Bilal Pro 05-14-2012 09:36

Re: Replace messages
 
How is he able to know that you have the new tattoo placed on ur ass :$?

bazhenov93 05-14-2012 16:05

Re: Replace messages
 
My avatar!!! are you blind!?


All times are GMT -4. The time now is 07:50.

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