AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why CT Model ReplacemenT?? (https://forums.alliedmods.net/showthread.php?t=100948)

KadiR 08-19-2009 12:48

Why CT Model ReplacemenT??
 
This code should replace all T's model to test999 Player Model. But it does replace all CT player Models too.. why??

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"

new Trie:g_tModels

public plugin_init()
{
    
register_plugin("KadiR Models"VERSION"ConnorMcLeod")

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue")

    
g_tModels TrieCreate()
    
TrieSetString(g_tModels"terror""test999")
    
TrieSetString(g_tModels"leet""test999")
    
TrieSetString(g_tModels"guerilla""test999")
    
TrieSetString(g_tModels"arctic""test999")
}

public 
plugin_end()
{
    
TrieDestroy(g_tModels)
}

public 
plugin_precache()
{
    
precache_model("models/player/test999/test999.mdl")
}

public 
SetClientKeyValue(idszInfoBuffer[], szKey[], szValue[])
{
    static const 
model[] = "model"
    
if( equal(szKeymodel) )
    {
        static 
szModel[12]
        
TrieGetString(g_tModelsszValueszModelcharsmax(szModel));
        
set_user_info(idmodelszModel)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED



vato loco [GE-S] 08-19-2009 17:51

Re: Why CT Model ReplacemenT??
 
because you are not cheking teams !!!
you should check like this example

PHP Code:

#include <cstrike> 

PHP Code:

if(cs_get_user_team(id) == CS_TEAM_T)
{
    
than set the model



crazyeffect 08-19-2009 17:52

Re: Why CT Model ReplacemenT??
 
Conor made this?

WTF is rong with him? He made a misstake :(

Exolent[jNr] 08-19-2009 18:21

Re: Why CT Model ReplacemenT??
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"

new Trie:g_tModels

public plugin_init()
{
    
register_plugin("KadiR Models"VERSION"ConnorMcLeod")

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue")

    
g_tModels TrieCreate()
    
TrieSetString(g_tModels"terror""test999")
    
TrieSetString(g_tModels"leet""test999")
    
TrieSetString(g_tModels"guerilla""test999")
    
TrieSetString(g_tModels"arctic""test999")
}

public 
plugin_end()
{
    
TrieDestroy(g_tModels)
}

public 
plugin_precache()
{
    
precache_model("models/player/test999/test999.mdl")
}

public 
SetClientKeyValue(idszInfoBuffer[], szKey[], szValue[])
{
    static const 
model[] = "model"
    
if( equal(szKeymodel) )
    {
        static 
szModel[12]
        if( 
TrieGetString(g_tModelsszValueszModelcharsmax(szModel)) )
        {
            
set_user_info(idmodelszModel)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED




All times are GMT -4. The time now is 15:13.

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