Raised This Month: $ Target: $400
 0% 

[HELP]Strange error (hud messages)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-18-2014 , 16:41   [HELP]Strange error (hud messages)
Reply With Quote #1

Hello, this is the code and I couldn't fix the error. Thanks for help!

PHP Code:
   #include <amxmodx> 
   #include <dhudmessage>

    #define PLUGIN "WinMSG" 
    #define VERSION "0.0.2" 

    
new Trie:g_tReplacements 


    
public plugin_init() 

        
register_plugin(PLUGINVERSION""
        
register_message(get_user_msgid("TextMsg"), "Message_TextMsg"
    
}

public 
hud_message(id)
{
    new 
g_name[32]
    
get_user_name(idg_name[id], 32)
    
g_tReplacements TrieCreate()  
    
TrieSetString(g_tReplacements"#Bomb_Planted",              "[CS-MaxGaminG.iNFO]^n%s zaloji bombata!"g_name);
    
TrieSetString(g_tReplacements"#CTs_Win",                   "[CS-MaxGaminG.iNFO]^nCounter-Teroristite specheliha!");
    
TrieSetString(g_tReplacements"#Terrorists_Win",            "[CS-MaxGaminG.iNFO]^nTeroristite specheliha!");
    
TrieSetString(g_tReplacements"#Round_Draw",                "[CS-MaxGaminG.iNFO]^nRundut se provali!");
    
TrieSetString(g_tReplacements"#Target_Saved",              "[CS-MaxGaminG.iNFO]^nCelta beshe zapazena!");
    
TrieSetString(g_tReplacements"#Game_Commencing",           "[CS-MaxGaminG.iNFO]^nDavaite, boi!");
    
TrieSetString(g_tReplacements"#Bomb_Defused",              "[CS-MaxGaminG.iNFO]^n%s obezvredi bombata!"g_name);
    
TrieSetString(g_tReplacements"#Target_Bombed",              "[CS-MaxGaminG.iNFO]^nBombata izbuhna!");
    
TrieSetString(g_tReplacements"##Auto_Team_Balance_Next_Round""[CS-MaxGaminG.iNFO]^nAvto Team Balance sled runda!");
}

    
    public 
Message_TextMsg(iMsgIdiMsgDestid
    { 
        if( !
id && get_msg_arg_int(1) == print_center 
        { 
            new 
szMessage[64
            
get_msg_arg_string(2szMessagecharsmax(szMessage)) 
            if( 
TrieGetString(g_tReplacementsszMessageszMessagecharsmax(szMessage)) ) 
            { 
                
set_dhudmessage(255255255, -1.00.212010.00.10.2)
                
show_dhudmessage(0szMessage
                return 
PLUGIN_HANDLED 
            

        } 
        return 
PLUGIN_CONTINUE 
    

And this is the error:
PHP Code:
ErrorNumber of arguments does not match definition on line 22 
and
PHP Code:
ErrorNumber of arguments does not match definition on line 28 
These are lines where in the hud i used g_name...
Flick3rR is offline
Send a message via Skype™ to Flick3rR
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-18-2014 , 16:48   Re: [HELP]Strange error (hud messages)
Reply With Quote #2

TrieSetString does not format strings, so you will need to call format first, then pass the formated string to TrieSetString
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-18-2014 , 17:01   Re: [HELP]Strange error (hud messages)
Reply With Quote #3

Allright, my english is so bad, so i can't understand you clearly. If you can give me some example, I may get what are you talking about... And how does the format calling happen..

Last edited by Flick3rR; 03-18-2014 at 17:04.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-18-2014 , 17:06   Re: [HELP]Strange error (hud messages)
Reply With Quote #4

Bad:
Code:
new variable[] = "text"; TrieSetString(hTrie, "This is %s", variable);

Good:
Code:
new variable[] = "text"; new string[64]; formatex(string, charsmax(string), "This is %s", variable); TrieSetString(hTrie, string);
__________________

Last edited by Black Rose; 03-18-2014 at 17:06.
Black Rose is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-18-2014 , 17:16   Re: [HELP]Strange error (hud messages)
Reply With Quote #5

I'll try this, but the main idea is to get the user name (this, who is planting the bomb). All the other stuff are working, but when i try to add the name, this happens. Thanks!
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Reply


Thread Tools
Display Modes

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 06:03.


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