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
Author Message
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 12-03-2010 , 20:46   [solved][THX] can someone plz look at code using first time Trie
Reply With Quote #1

Plz someone check if code is correct...
never used Trie befor so i'm not 100% sure about it

thx inadvance
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "ned"

new Trie:g_tRemoveEntities
new const g_iRemoveEntities[][] = {
    
"func_bomb_target""info_bomb_target""hostage_entity""monster_scientist"
    
"func_hostage_rescue""info_hostage_rescue","info_vip_start""func_vip_safetyzone"
    
"func_escapezone","armoury_entity""game_player_equip""player_weaponstrip","info_deathmatch_start" 
}

new 
Trie:g_tdoorSnd
new const g_doorSnd[][] = {
    
"doors/doorstop1.wav",
    
"doors/doorstop2.wav",
    
"doors/doorstop3.wav"
}

new 
Trie:g_tpainSnd
new const g_painSnd[][] = {
    
"player/pl_pain2.wav""player/pl_pain3.wav""player/pl_pain4.wav""player/pl_pain5.wav",
    
"player/pl_pain6.wav""player/pl_pain7.wav""player/bhit_kevlar-1.wav""player/bhit_flesh-1.wav",
    
"player/bhit_flesh-2.wav""player/bhit_flesh-3.wav"
}

new 
Trie:g_twaterSnd
new const g_waterSnd[][] = {
    
"player/pl_swim1.wav""player/pl_swim2.wav",
    
"player/pl_swim3.wav""player/pl_swim4.wav",
    
"player/waterrun.wav"
}

new 
g_kz_doorsoundg_kz_painsoundg_kz_watersound

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_EmitSound"fw_EmitSound")
    
    
g_kz_doorsound register_cvar("kz_doorsound","1")
    
g_kz_painsound register_cvar("kz_painsound","1")
    
g_kz_watersound register_cvar("kz_watersound","1")
    
    
g_tRemoveEntities TrieCreate()
    for(new 
0sizeof(g_iRemoveEntities); i++)
    {
        
TrieSetCell(g_tRemoveEntitiesg_iRemoveEntities[i], i)
    }
    
    
g_tdoorSnd TrieCreate()
    for(new 
0sizeof(g_doorSnd); i++)
    {
        
TrieSetCell(g_tdoorSndg_doorSnd[i], i)
    }
    
    
g_tpainSnd TrieCreate()
    for(new 
0sizeof(g_painSnd); i++)
    {
        
TrieSetCell(g_tpainSndg_painSnd[i], i)
    }
    
    
g_twaterSnd TrieCreate()
    for(new 
0sizeof(g_waterSnd); i++)
    {
        
TrieSetCell(g_twaterSndg_waterSnd[i], i)
    }
}

public 
plugin_precache() 
{
    
register_forward(FM_Spawn"fw_Spawn"0)
}

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

public 
fw_Spawn(iEnt)
{
    if(!
pev_valid(iEnt))
    {
        return 
FMRES_IGNORED
    
}
    new 
ClassName[32]
    
pev(iEntpev_classnameClassName31)
    
    if(
TrieKeyExists(g_tRemoveEntitiesClassName))
    {
        
engfunc(EngFunc_RemoveEntityiEnt)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

__________________

Last edited by vato loco [GE-S]; 12-04-2010 at 10:18.
vato loco [GE-S] 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