Ayuda: Players Models
#1
Estrella 
Quisiera que este plugins lo pueda utilizar guadando skin pero no por Steamid que sea por NickName.

Código PHP:
/*    Formatright © 2009, ConnorMcLeod

    Players Models is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Players Models; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

// #define SET_MODELINDEX

#include <amxmodx>
#include <fakemeta>

#define VERSION "1.3.1"

#define SetUserModeled(%1)        g_bModeled |= 1<<(%1 & 31)
#define SetUserNotModeled(%1)        g_bModeled &= ~( 1<<(%1 & 31) )
#define IsUserModeled(%1)        ( g_bModeled &  1<<(%1 & 31) )

#define SetUserConnected(%1)        g_bConnected |= 1<<(%1 & 31)
#define SetUserNotConnected(%1)        g_bConnected &= ~( 1<<(%1 & 31) )
#define IsUserConnected(%1)        ( g_bConnected &  1<<(%1 & 31) )

#define MAX_MODEL_LENGTH    16
#define MAX_AUTHID_LENGTH 25

#define MAX_PLAYERS    32

#define ClCorpse_ModelName 1
#define ClCorpse_PlayerID 12

#define m_iTeam 114
#define g_ulModelIndexPlayer 491
#define fm_cs_get_user_team_index(%1)    get_pdata_int(%1, m_iTeam)

new const MODEL[] = "model";
new 
g_bModeled;
new 
g_szCurrentModel[MAX_PLAYERS+1][MAX_MODEL_LENGTH];

new 
Trie:g_tTeamModels[2];
new 
Trie:g_tModelIndexes;
new 
Trie:g_tDefaultModels;

new 
g_szAuthid[MAX_PLAYERS+1][MAX_AUTHID_LENGTH];
new 
g_bPersonalModel[MAX_PLAYERS+1];

new 
g_bConnected;

public 
plugin_init()
{
    
register_plugin("Players Models"VERSION"ConnorMcLeod");

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue");
    
register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse");
}

public 
plugin_precache()
{
    new 
szConfigFile[128];
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile));
    
format(szConfigFilecharsmax(szConfigFile), "%s/players_models.ini"szConfigFile);

    new 
iFile fopen(szConfigFile"rt");
    if( 
iFile )
    {
        new const 
szDefaultModels[][] = {"""urban""terror""leet""arctic""gsg9"
                    
"gign""sas""guerilla""vip""militia""spetsnaz" };
        
g_tDefaultModels TrieCreate();
        for(new 
i=1i<sizeof(szDefaultModels); i++)
        {
            
TrieSetCell(g_tDefaultModelsszDefaultModels[i], i);
        }

        
g_tModelIndexes TrieCreate();

        
g_tTeamModels[0] = TrieCreate();
        
g_tTeamModels[1] = TrieCreate();

        new 
szDatas[70], szRest[40], szKey[MAX_AUTHID_LENGTH], szModel1[MAX_MODEL_LENGTH], szModel2[MAX_MODEL_LENGTH];
        while( !
feof(iFile) )
        {
            
fgets(iFileszDatascharsmax(szDatas));
            
trim(szDatas);
            if(!
szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
            {
                continue;
            }

            
parse(szDatasszKeycharsmax(szKey), szModel1charsmax(szModel1), szModel2charsmax(szModel2));

            if( 
TrieKeyExists(g_tDefaultModelsszKey) )
            {
                if( 
szModel1[0] && !equal(szModel1szKey) && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tDefaultModelsszKeyszModel1);
                }
            }
            else if( 
equal(szKey"STEAM_"6) || equal(szKey"BOT") )
            {
                
parse(szRestszModel1charsmax(szModel1), szModel2charsmax(szModel2));
                if( 
szModel1[0] && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tTeamModels[1], szKeyszModel1);
                }
                if( 
szModel2[0] && PrecachePlayerModel(szModel2) )
                {
                    
TrieSetString(g_tTeamModels[0], szKeyszModel2);
                }
            }
        }
        
fcloseiFile );
    }
}

PrecachePlayerModel( const szModel[] )
{
    if( 
TrieKeyExists(g_tModelIndexesszModel) )
    {
        return 
1;
    }

    new 
szFileToPrecache[64];
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%s.mdl"szModelszModel);
    if( !
file_existsszFileToPrecache ) && !TrieKeyExists(g_tDefaultModelsszModel) )
    {
        return 
0;
    }

    
TrieSetCell(g_tModelIndexesszModelprecache_model(szFileToPrecache));

    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%st.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%sT.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }

    return 
1;
}

public 
plugin_end()
{
    
TrieDestroy(g_tTeamModels[0]);
    
TrieDestroy(g_tTeamModels[1]);
    
TrieDestroy(g_tModelIndexes);
    
TrieDestroy(g_tDefaultModels);
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szAuthid[id], MAX_AUTHID_LENGTH-1);

    for(new 
i=1i<=2i++)
    {
        if( 
TrieKeyExists(g_tTeamModels[2-i], g_szAuthid[id]) )
        {
            
g_bPersonalModel[id] |= i;
        }
        else
        {
            
g_bPersonalModel[id] &= ~i;
        }
    }
}

public 
client_putinserver(id)
{
    if( !
is_user_hltv(id) )
    {
        
SetUserConnected(id);
    }
}

public 
client_disconnect(id)
{
    
g_bPersonalModel[id] = 0;
    
SetUserNotModeled(id);
    
SetUserNotConnected(id);
}

public 
SetClientKeyValue(id, const szInfoBuffer[], const szKey[], const szValue[])
{
    if( 
equal(szKeyMODEL) && IsUserConnected(id) )
    {
        new 
iTeam fm_cs_get_user_team_index(id);
        if( 
<= iTeam <= )
        {
            new 
szSupposedModel[MAX_MODEL_LENGTH];

            if( 
g_bPersonalModel[id] & iTeam )
            {
                
TrieGetString(g_tTeamModels[2-iTeam], g_szAuthid[id], szSupposedModelcharsmax(szSupposedModel));
            }
            else
            {
                
TrieGetString(g_tDefaultModelsszValueszSupposedModelcharsmax(szSupposedModel));
            }

            if( 
szSupposedModel[0] )
            {
                if(    !
IsUserModeled(id)
                ||    !
equal(g_szCurrentModel[id], szSupposedModel)
                ||    !
equal(szValueszSupposedModel)    )
                {
                    
copy(g_szCurrentModel[id], MAX_MODEL_LENGTH-1szSupposedModel);
                    
SetUserModeled(id);
                    
set_user_info(idMODELszSupposedModel);
                
#if defined SET_MODELINDEX
                    
new iModelIndex;
                    
TrieGetCell(g_tModelIndexesszSupposedModeliModelIndex);
                
//    set_pev(id, pev_modelindex, iModelIndex); // is this needed ?
                    
set_pdata_int(idg_ulModelIndexPlayeriModelIndex);
                
#endif
                    
return FMRES_SUPERCEDE;
                }
            }

            if( 
IsUserModeled(id) )
            {
                
SetUserNotModeled(id);
                
g_szCurrentModel[id][0] = 0;
            }
        }
    }
    return 
FMRES_IGNORED;
}

public 
Message_ClCorpse()
{
    new 
id get_msg_arg_int(ClCorpse_PlayerID);
    if( 
IsUserModeled(id) )
    {
        
set_msg_arg_string(ClCorpse_ModelNameg_szCurrentModel[id]);
    }


Entiendo que este plugin permite establecer modelos de jugadores según Steamid, o reemplazar modelos predeterminados. Lo que yo quiero es que establezca los modelos de jugadores por nombre (Nick). Este plugin lleva un archivo de configuración.

Archivo de configuración: players_models.ini
Código PHP:
// replace default skins
"defaultname" "newname"

// set skin according to steamid
"STEAM_0:1:23456789" "terrorist_model" "ct_model" 

Ejemplo:
Código PHP:
// replace default skins
"sas" "batman"
"gign" "robin"

// set skin according to steamid
"STEAM_0:1:23456789" "benladen" "vip"
"BOT" "" "gign" 

Lo que busco es que esto se configure de esta manera:
Código PHP:
// replace default skins
"defaultname" "newname"

// set skin according to steamid
"NickName" "terrorist_model" "ct_model" 
Responder
#2
(21/10/2018, 02:02 PM)Axon escribió: Quisiera que este plugins lo pueda utilizar guadando skin pero no por Steamid que sea por NickName.

Código PHP:
/*    Formatright © 2009, ConnorMcLeod

    Players Models is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Players Models; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

// #define SET_MODELINDEX

#include <amxmodx>
#include <fakemeta>

#define VERSION "1.3.1"

#define SetUserModeled(%1)        g_bModeled |= 1<<(%1 & 31)
#define SetUserNotModeled(%1)        g_bModeled &= ~( 1<<(%1 & 31) )
#define IsUserModeled(%1)        ( g_bModeled &  1<<(%1 & 31) )

#define SetUserConnected(%1)        g_bConnected |= 1<<(%1 & 31)
#define SetUserNotConnected(%1)        g_bConnected &= ~( 1<<(%1 & 31) )
#define IsUserConnected(%1)        ( g_bConnected &  1<<(%1 & 31) )

#define MAX_MODEL_LENGTH    16
#define MAX_AUTHID_LENGTH 25

#define MAX_PLAYERS    32

#define ClCorpse_ModelName 1
#define ClCorpse_PlayerID 12

#define m_iTeam 114
#define g_ulModelIndexPlayer 491
#define fm_cs_get_user_team_index(%1)    get_pdata_int(%1, m_iTeam)

new const MODEL[] = "model";
new 
g_bModeled;
new 
g_szCurrentModel[MAX_PLAYERS+1][MAX_MODEL_LENGTH];

new 
Trie:g_tTeamModels[2];
new 
Trie:g_tModelIndexes;
new 
Trie:g_tDefaultModels;

new 
g_szAuthid[MAX_PLAYERS+1][MAX_AUTHID_LENGTH];
new 
g_bPersonalModel[MAX_PLAYERS+1];

new 
g_bConnected;

public 
plugin_init()
{
    
register_plugin("Players Models"VERSION"ConnorMcLeod");

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue");
    
register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse");
}

public 
plugin_precache()
{
    new 
szConfigFile[128];
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile));
    
format(szConfigFilecharsmax(szConfigFile), "%s/players_models.ini"szConfigFile);

    new 
iFile fopen(szConfigFile"rt");
    if( 
iFile )
    {
        new const 
szDefaultModels[][] = {"""urban""terror""leet""arctic""gsg9"
                    
"gign""sas""guerilla""vip""militia""spetsnaz" };
        
g_tDefaultModels TrieCreate();
        for(new 
i=1i<sizeof(szDefaultModels); i++)
        {
            
TrieSetCell(g_tDefaultModelsszDefaultModels[i], i);
        }

        
g_tModelIndexes TrieCreate();

        
g_tTeamModels[0] = TrieCreate();
        
g_tTeamModels[1] = TrieCreate();

        new 
szDatas[70], szRest[40], szKey[MAX_AUTHID_LENGTH], szModel1[MAX_MODEL_LENGTH], szModel2[MAX_MODEL_LENGTH];
        while( !
feof(iFile) )
        {
            
fgets(iFileszDatascharsmax(szDatas));
            
trim(szDatas);
            if(!
szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
            {
                continue;
            }

            
parse(szDatasszKeycharsmax(szKey), szModel1charsmax(szModel1), szModel2charsmax(szModel2));

            if( 
TrieKeyExists(g_tDefaultModelsszKey) )
            {
                if( 
szModel1[0] && !equal(szModel1szKey) && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tDefaultModelsszKeyszModel1);
                }
            }
            else if( 
equal(szKey"STEAM_"6) || equal(szKey"BOT") )
            {
                
parse(szRestszModel1charsmax(szModel1), szModel2charsmax(szModel2));
                if( 
szModel1[0] && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tTeamModels[1], szKeyszModel1);
                }
                if( 
szModel2[0] && PrecachePlayerModel(szModel2) )
                {
                    
TrieSetString(g_tTeamModels[0], szKeyszModel2);
                }
            }
        }
        
fcloseiFile );
    }
}

PrecachePlayerModel( const szModel[] )
{
    if( 
TrieKeyExists(g_tModelIndexesszModel) )
    {
        return 
1;
    }

    new 
szFileToPrecache[64];
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%s.mdl"szModelszModel);
    if( !
file_existsszFileToPrecache ) && !TrieKeyExists(g_tDefaultModelsszModel) )
    {
        return 
0;
    }

    
TrieSetCell(g_tModelIndexesszModelprecache_model(szFileToPrecache));

    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%st.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%sT.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }

    return 
1;
}

public 
plugin_end()
{
    
TrieDestroy(g_tTeamModels[0]);
    
TrieDestroy(g_tTeamModels[1]);
    
TrieDestroy(g_tModelIndexes);
    
TrieDestroy(g_tDefaultModels);
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szAuthid[id], MAX_AUTHID_LENGTH-1);

    for(new 
i=1i<=2i++)
    {
        if( 
TrieKeyExists(g_tTeamModels[2-i], g_szAuthid[id]) )
        {
            
g_bPersonalModel[id] |= i;
        }
        else
        {
            
g_bPersonalModel[id] &= ~i;
        }
    }
}

public 
client_putinserver(id)
{
    if( !
is_user_hltv(id) )
    {
        
SetUserConnected(id);
    }
}

public 
client_disconnect(id)
{
    
g_bPersonalModel[id] = 0;
    
SetUserNotModeled(id);
    
SetUserNotConnected(id);
}

public 
SetClientKeyValue(id, const szInfoBuffer[], const szKey[], const szValue[])
{
    if( 
equal(szKeyMODEL) && IsUserConnected(id) )
    {
        new 
iTeam fm_cs_get_user_team_index(id);
        if( 
<= iTeam <= )
        {
            new 
szSupposedModel[MAX_MODEL_LENGTH];

            if( 
g_bPersonalModel[id] & iTeam )
            {
                
TrieGetString(g_tTeamModels[2-iTeam], g_szAuthid[id], szSupposedModelcharsmax(szSupposedModel));
            }
            else
            {
                
TrieGetString(g_tDefaultModelsszValueszSupposedModelcharsmax(szSupposedModel));
            }

            if( 
szSupposedModel[0] )
            {
                if(    !
IsUserModeled(id)
                ||    !
equal(g_szCurrentModel[id], szSupposedModel)
                ||    !
equal(szValueszSupposedModel)    )
                {
                    
copy(g_szCurrentModel[id], MAX_MODEL_LENGTH-1szSupposedModel);
                    
SetUserModeled(id);
                    
set_user_info(idMODELszSupposedModel);
                
#if defined SET_MODELINDEX
                    
new iModelIndex;
                    
TrieGetCell(g_tModelIndexesszSupposedModeliModelIndex);
                
//    set_pev(id, pev_modelindex, iModelIndex); // is this needed ?
                    
set_pdata_int(idg_ulModelIndexPlayeriModelIndex);
                
#endif
                    
return FMRES_SUPERCEDE;
                }
            }

            if( 
IsUserModeled(id) )
            {
                
SetUserNotModeled(id);
                
g_szCurrentModel[id][0] = 0;
            }
        }
    }
    return 
FMRES_IGNORED;
}

public 
Message_ClCorpse()
{
    new 
id get_msg_arg_int(ClCorpse_PlayerID);
    if( 
IsUserModeled(id) )
    {
        
set_msg_arg_string(ClCorpse_ModelNameg_szCurrentModel[id]);
    }


Quieres que guarde las Skines que elijan o que guarden los NickNames?
Cita: Kikizon2 Dijo :
Lo que deberian de aprender es a escribir, parece que escriben con el escroto en la mano.
Responder
#3
(21/10/2018, 05:31 PM)KevinJesus escribió:
(21/10/2018, 02:02 PM)Axon escribió: Quisiera que este plugins lo pueda utilizar guadando skin pero no por Steamid que sea por NickName.

Código PHP:
/*    Formatright © 2009, ConnorMcLeod

    Players Models is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Players Models; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

// #define SET_MODELINDEX

#include <amxmodx>
#include <fakemeta>

#define VERSION "1.3.1"

#define SetUserModeled(%1)        g_bModeled |= 1<<(%1 & 31)
#define SetUserNotModeled(%1)        g_bModeled &= ~( 1<<(%1 & 31) )
#define IsUserModeled(%1)        ( g_bModeled &  1<<(%1 & 31) )

#define SetUserConnected(%1)        g_bConnected |= 1<<(%1 & 31)
#define SetUserNotConnected(%1)        g_bConnected &= ~( 1<<(%1 & 31) )
#define IsUserConnected(%1)        ( g_bConnected &  1<<(%1 & 31) )

#define MAX_MODEL_LENGTH    16
#define MAX_AUTHID_LENGTH 25

#define MAX_PLAYERS    32

#define ClCorpse_ModelName 1
#define ClCorpse_PlayerID 12

#define m_iTeam 114
#define g_ulModelIndexPlayer 491
#define fm_cs_get_user_team_index(%1)    get_pdata_int(%1, m_iTeam)

new const MODEL[] = "model";
new 
g_bModeled;
new 
g_szCurrentModel[MAX_PLAYERS+1][MAX_MODEL_LENGTH];

new 
Trie:g_tTeamModels[2];
new 
Trie:g_tModelIndexes;
new 
Trie:g_tDefaultModels;

new 
g_szAuthid[MAX_PLAYERS+1][MAX_AUTHID_LENGTH];
new 
g_bPersonalModel[MAX_PLAYERS+1];

new 
g_bConnected;

public 
plugin_init()
{
    
register_plugin("Players Models"VERSION"ConnorMcLeod");

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue");
    
register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse");
}

public 
plugin_precache()
{
    new 
szConfigFile[128];
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile));
    
format(szConfigFilecharsmax(szConfigFile), "%s/players_models.ini"szConfigFile);

    new 
iFile fopen(szConfigFile"rt");
    if( 
iFile )
    {
        new const 
szDefaultModels[][] = {"""urban""terror""leet""arctic""gsg9"
                    
"gign""sas""guerilla""vip""militia""spetsnaz" };
        
g_tDefaultModels TrieCreate();
        for(new 
i=1i<sizeof(szDefaultModels); i++)
        {
            
TrieSetCell(g_tDefaultModelsszDefaultModels[i], i);
        }

        
g_tModelIndexes TrieCreate();

        
g_tTeamModels[0] = TrieCreate();
        
g_tTeamModels[1] = TrieCreate();

        new 
szDatas[70], szRest[40], szKey[MAX_AUTHID_LENGTH], szModel1[MAX_MODEL_LENGTH], szModel2[MAX_MODEL_LENGTH];
        while( !
feof(iFile) )
        {
            
fgets(iFileszDatascharsmax(szDatas));
            
trim(szDatas);
            if(!
szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
            {
                continue;
            }

            
parse(szDatasszKeycharsmax(szKey), szModel1charsmax(szModel1), szModel2charsmax(szModel2));

            if( 
TrieKeyExists(g_tDefaultModelsszKey) )
            {
                if( 
szModel1[0] && !equal(szModel1szKey) && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tDefaultModelsszKeyszModel1);
                }
            }
            else if( 
equal(szKey"STEAM_"6) || equal(szKey"BOT") )
            {
                
parse(szRestszModel1charsmax(szModel1), szModel2charsmax(szModel2));
                if( 
szModel1[0] && PrecachePlayerModel(szModel1) )
                {
                    
TrieSetString(g_tTeamModels[1], szKeyszModel1);
                }
                if( 
szModel2[0] && PrecachePlayerModel(szModel2) )
                {
                    
TrieSetString(g_tTeamModels[0], szKeyszModel2);
                }
            }
        }
        
fcloseiFile );
    }
}

PrecachePlayerModel( const szModel[] )
{
    if( 
TrieKeyExists(g_tModelIndexesszModel) )
    {
        return 
1;
    }

    new 
szFileToPrecache[64];
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%s.mdl"szModelszModel);
    if( !
file_existsszFileToPrecache ) && !TrieKeyExists(g_tDefaultModelsszModel) )
    {
        return 
0;
    }

    
TrieSetCell(g_tModelIndexesszModelprecache_model(szFileToPrecache));

    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%st.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }
    
formatex(szFileToPrecachecharsmax(szFileToPrecache), "models/player/%s/%sT.mdl"szModelszModel);
    if( 
file_existsszFileToPrecache ) )
    {
        
precache_model(szFileToPrecache);
        return 
1;
    }

    return 
1;
}

public 
plugin_end()
{
    
TrieDestroy(g_tTeamModels[0]);
    
TrieDestroy(g_tTeamModels[1]);
    
TrieDestroy(g_tModelIndexes);
    
TrieDestroy(g_tDefaultModels);
}

public 
client_authorizedid )
{
    
get_user_authid(idg_szAuthid[id], MAX_AUTHID_LENGTH-1);

    for(new 
i=1i<=2i++)
    {
        if( 
TrieKeyExists(g_tTeamModels[2-i], g_szAuthid[id]) )
        {
            
g_bPersonalModel[id] |= i;
        }
        else
        {
            
g_bPersonalModel[id] &= ~i;
        }
    }
}

public 
client_putinserver(id)
{
    if( !
is_user_hltv(id) )
    {
        
SetUserConnected(id);
    }
}

public 
client_disconnect(id)
{
    
g_bPersonalModel[id] = 0;
    
SetUserNotModeled(id);
    
SetUserNotConnected(id);
}

public 
SetClientKeyValue(id, const szInfoBuffer[], const szKey[], const szValue[])
{
    if( 
equal(szKeyMODEL) && IsUserConnected(id) )
    {
        new 
iTeam fm_cs_get_user_team_index(id);
        if( 
<= iTeam <= )
        {
            new 
szSupposedModel[MAX_MODEL_LENGTH];

            if( 
g_bPersonalModel[id] & iTeam )
            {
                
TrieGetString(g_tTeamModels[2-iTeam], g_szAuthid[id], szSupposedModelcharsmax(szSupposedModel));
            }
            else
            {
                
TrieGetString(g_tDefaultModelsszValueszSupposedModelcharsmax(szSupposedModel));
            }

            if( 
szSupposedModel[0] )
            {
                if(    !
IsUserModeled(id)
                ||    !
equal(g_szCurrentModel[id], szSupposedModel)
                ||    !
equal(szValueszSupposedModel)    )
                {
                    
copy(g_szCurrentModel[id], MAX_MODEL_LENGTH-1szSupposedModel);
                    
SetUserModeled(id);
                    
set_user_info(idMODELszSupposedModel);
                
#if defined SET_MODELINDEX
                    
new iModelIndex;
                    
TrieGetCell(g_tModelIndexesszSupposedModeliModelIndex);
                
//    set_pev(id, pev_modelindex, iModelIndex); // is this needed ?
                    
set_pdata_int(idg_ulModelIndexPlayeriModelIndex);
                
#endif
                    
return FMRES_SUPERCEDE;
                }
            }

            if( 
IsUserModeled(id) )
            {
                
SetUserNotModeled(id);
                
g_szCurrentModel[id][0] = 0;
            }
        }
    }
    return 
FMRES_IGNORED;
}

public 
Message_ClCorpse()
{
    new 
id get_msg_arg_int(ClCorpse_PlayerID);
    if( 
IsUserModeled(id) )
    {
        
set_msg_arg_string(ClCorpse_ModelNameg_szCurrentModel[id]);
    }


Quieres que guarde las Skines que elijan o que guarden los NickNames?
Entiendo que este plugin permite establecer modelos de jugadores según Steamid, o reemplazar modelos predeterminados. Lo que yo quiero es que establezca los modelos de jugadores por nombre (Nick). Este plugin lleva un archivo de configuración.

Archivo de configuración: players_models.ini
Código PHP:
// replace default skins
"defaultname" "newname"

// set skin according to steamid
"STEAM_0:1:23456789" "terrorist_model" "ct_model" 

Ejemplo:
Código PHP:
// replace default skins
"sas" "batman"
"gign" "robin"

// set skin according to steamid
"STEAM_0:1:23456789" "benladen" "vip"
"BOT" "" "gign" 

Lo que busco es que esto se configure de esta manera:
Código PHP:
// replace default skins
"defaultname" "newname"

// set skin according to steamid
"NickName" "terrorist_model" "ct_model" 
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)