Raised This Month: $ Target: $400
 0% 

[solved][THX] can someone plz look at code using first time Trie


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-04-2010 , 03:53   Re: can someone plz look at code using first time Trie
Reply With Quote #3

const arrays can be declared in pplugin_init to memory is freed after it.
Also, for example i would organize emitsound callback like this, make more sense for me :

PHP Code:
public fw_EmitSound(iEntchannel, const sound[]) 
{
    if(
TrieKeyExists(g_tdoorSndsound))
    {
        if(
get_pcvar_num(g_kz_doorsound))
        {
            return 
FMRES_SUPERCEDE
        
}
    }
    else if(
TrieKeyExists(g_tpainSndsound))
    {
        if(
get_pcvar_num(g_kz_painsound))
        {
            return 
FMRES_SUPERCEDE
        
}
    }
    else if(
TrieKeyExists(g_twaterSndsound))
    {
        if(
get_pcvar_num(g_kz_watersound))
        {
            return 
FMRES_SUPERCEDE
        
}
    }
    else if(
TrieKeyExists(g_tdoorSndsound))
    {
        if(
get_pcvar_num(g_kz_doorsound))
        {
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED

Last, i don't think water sounds are done with EmitSound, you should check it (try to pass in water, you should hear water sounds whatever the cvar value).


Better than cvars, make a config file in which you put something like remove_doorsounds 1, if 1, fill a Trie called g_trieRemoveSounds with doors sounds names, you could then make only 1 check (trie key exists) in callback.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 11:24.


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