Raised This Month: $ Target: $400
 0% 

Replace messages


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 04-28-2012 , 07:20   Replace messages
Reply With Quote #1

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 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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