Raised This Month: $51 Target: $400
 12% 

Force T & CT player models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 01-14-2018 , 07:20   Force T & CT player models
Reply With Quote #1

I know i have found some plugin for this back in the day but it was pretty hard to install.
So im just searching for more simple version if it exist or someone could make it.

I want CT team to have ctx.model
I want T team to have tx.model

Everyone should see those models.

Thanks!
4ever16 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 01-14-2018 , 07:32   Re: Force T & CT player models
Reply With Quote #2

I found one Players Models 1.3.1 https://forums.alliedmods.net/showthread.php?p=958925
But how do i config it so it replace default models in a correct way i think i had trouble last time doing this so i just skipped the plugin.

Last edited by 4ever16; 01-14-2018 at 07:32.
4ever16 is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 01-14-2018 , 08:56   Re: Force T & CT player models
Reply With Quote #3

i'm lazy too, here you go.
PHP Code:
public plugin_init() {
    
register_plugin("Admin Model""1.0""Tahiri")
    
RegisterHam(Ham_Spawn,     "player""ham_PlayerSpawn_Post"1)
    return 
PLUGIN_CONTINUE
}
public 
plugin_precache() {
    for(new 
i=1model[92]; i<4i++) {
        
formatex(model91"models/player/sya_ct%d/sya_ct%d.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_ct%d/sya_ct%dT.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_terro%d/sya_terro%d.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_terro%d/sya_terro%dT.mdl"ii)
        
precache_model(model)
    }
    return 
PLUGIN_CONTINUE
}

public 
ham_PlayerSpawn_Post(id)
{
    if (
is_user_alive(id))
    {
        new 
model[32]
        
formatex(modelcharsmax(model), "sya_%s%d"cs_get_user_team(id) == TEAM_CT "ct" "terro"random_num(1,3))
        
cs_set_user_model(idmodel)
    }
    return 
PLUGIN_CONTINUE

__________________

Last edited by TheWhitesmith; 01-14-2018 at 08:57. Reason: some ReGameDLL natives removed
TheWhitesmith is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-14-2018 , 10:04   Re: Force T & CT player models
Reply With Quote #4

Quote:
Originally Posted by TheWhitesmith View Post
i'm lazy too, here you go.
PHP Code:
public plugin_init() {
    
register_plugin("Admin Model""1.0""Tahiri")
    
RegisterHam(Ham_Spawn,     "player""ham_PlayerSpawn_Post"1)
    return 
PLUGIN_CONTINUE
}
public 
plugin_precache() {
    for(new 
i=1model[92]; i<4i++) {
        
formatex(model91"models/player/sya_ct%d/sya_ct%d.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_ct%d/sya_ct%dT.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_terro%d/sya_terro%d.mdl"ii)
        
precache_model(model)
        
formatex(model91"models/player/sya_terro%d/sya_terro%dT.mdl"ii)
        
precache_model(model)
    }
    return 
PLUGIN_CONTINUE
}

public 
ham_PlayerSpawn_Post(id)
{
    if (
is_user_alive(id))
    {
        new 
model[32]
        
formatex(modelcharsmax(model), "sya_%s%d"cs_get_user_team(id) == TEAM_CT "ct" "terro"random_num(1,3))
        
cs_set_user_model(idmodel)
    }
    return 
PLUGIN_CONTINUE

That plugin won't work and most likely will overflow the players when the server is full.

Here you go:
PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >

#define MODELCHANGE_DELAY 0.8

#define TASK_MODELSET 125492

new const g_szTModel[ ] = "t_model";
new const 
g_szCTModel[ ] = "ct_model";

new 
bool:g_bHasCustomModel33 ];

new 
Float:g_fRoundStartTimeFloat:g_fModelsTargetTime;

public 
plugin_init( )
{
    
register_plugin"Player Models""1.0""DoNii" ) ;
    
    
register_event"HLTV""OnRoundStart""a""1=0""2=0" );
    
    
RegisterHamHam_Spawn"player""fw_HamSpawnPost") ;
    
    
register_forwardFM_ClientUserInfoChanged"fw_ClientUserInfoChanged" );
    
register_forwardFM_SetClientKeyValue"fw_SetClientKeyValue" );
}

public 
plugin_precache( )
{
    new 
szModelT64 ], szModelCT64 ];

    
formatexszModelTcharsmaxszModelT ), "models/player/%s/%s.mdl"g_szTModelg_szTModel ) ;
    
formatexszModelCTcharsmaxszModelCT ), "models/player/%s/%s.mdl"g_szCTModelg_szCTModel ) ;
    
    
precache_modelszModelT );
    
precache_modelszModelCT );
}

public 
OnRoundStart( )
g_fRoundStartTime get_gametime( );

public 
client_connectid )
g_bHasCustomModelid ] = false;

public 
fw_HamSpawnPostid )
{
    if( ! 
is_user_aliveid ) )
    return 
HAM_IGNORED ;

    new 
szCurrentModel32 ], Float:fGameTime;
    
get_user_infoid"model"szCurrentModelcharsmaxszCurrentModel ) )
    
    
fGameTime get_gametime( );
    
    if( 
get_user_teamid ) == )
    {
        if ( ! 
equalszCurrentModelg_szTModel ) )
        {
            if( 
fGameTime g_fRoundStartTime 1.0 )
            
set_taskMODELCHANGE_DELAY"fm_user_model_update"id TASK_MODELSET );
            
            else
            
fm_user_model_updateid TASK_MODELSET );
        }
    }
    
    else if( 
get_user_teamid ) == )
    {
        if ( ! 
equalszCurrentModelg_szCTModel ) )
        {
            if( 
fGameTime g_fRoundStartTime 1.0 )
            
set_taskMODELCHANGE_DELAY"fm_user_model_update"id TASK_MODELSET );
            
            else
            
fm_user_model_updateid TASK_MODELSET );
        }
    }
    
    return 
HAM_IGNORED ;
}

public 
fw_SetClientKeyValueid, const szBuffer[ ], const szKey[ ] )
{   
    if( 
equalszKey"model" ) )
    return 
FMRES_SUPERCEDE;
    
    return 
FMRES_IGNORED;
}

public 
fw_ClientUserInfoChanged(id)
{
    if( ! 
g_bHasCustomModelid ] )
    return 
FMRES_IGNORED;
    
    static 
szCurrentModel32 ];
    
fm_get_user_modelidszCurrentModelcharsmaxszCurrentModel ) );
    
    if( 
get_user_teamid ) == )
    {
        if( ! 
equalszCurrentModelg_szTModel ) && ! task_existsid TASK_MODELSET ) )
        
fm_set_user_modelid TASK_MODELSET );
    }
    
    else if( 
get_user_teamid ) == )
    {
        if( ! 
equalszCurrentModelg_szCTModel ) && ! task_existsid TASK_MODELSET ) )
        
fm_set_user_modelid TASK_MODELSET );
    }

    return 
FMRES_IGNORED;
}

public 
fm_user_model_updateiTaskID )
{
    static 
Float:fCurTime;
    
fCurTime get_gametime( );
    
    if ( 
fCurTime g_fModelsTargetTime >= MODELCHANGE_DELAY )
    {
        
fm_set_user_modeliTaskID )
        
g_fModelsTargetTime fCurTime;
    }
    
    else
    {
        
set_task( ( g_fModelsTargetTime MODELCHANGE_DELAY ) - fCurTime"fm_set_user_model"iTaskID );
        
g_fModelsTargetTime += MODELCHANGE_DELAY
    
}
}

public 
fm_set_user_modelid )
{
    
id -= TASK_MODELSET
    
    
if( get_user_teamid ) == )
    {
        
engfuncEngFunc_SetClientKeyValueidengfuncEngFunc_GetInfoKeyBufferid ), "model"g_szTModel );
        
g_bHasCustomModelid ] = true;
    }
    
    else if( 
get_user_teamid ) == )
    {
        
engfuncEngFunc_SetClientKeyValueidengfuncEngFunc_GetInfoKeyBufferid ), "model"g_szCTModel );
        
g_bHasCustomModelid ] = true;
    }

    return 
PLUGIN_CONTINUE;
}

stock fm_get_user_modelid, const szModel[], iLen )
{
    
engfuncEngFunc_InfoKeyValueengfuncEngFunc_GetInfoKeyBufferid ), "szModel"szModeliLen );

__________________

Last edited by edon1337; 01-14-2018 at 10:12.
edon1337 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 02-01-2018 , 08:08   Re: Force T & CT player models
Reply With Quote #5

Hi edon.

Can u just explain the plugin?
Which name should the models have?

Quote:
formatex( szModelT, charsmax( szModelT ), "models/player/%s/%s.mdl", g_szTModel, g_szTModel ) ;
formatex( szModelCT, charsmax( szModelCT ), "models/player/%s/%s.mdl", g_szCTModel, g_szCTModel ) ;
Quote:
new const g_szTModel[ ] = "t_model";
new const g_szCTModel[ ] = "ct_model";
4ever16 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-01-2018 , 08:58   Re: Force T & CT player models
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?p=958925

Flexible plugin ever
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-01-2018 , 13:25   Re: Force T & CT player models
Reply With Quote #7

Quote:
Originally Posted by 4ever16 View Post
Hi edon.

Can u just explain the plugin?
Which name should the models have?
PHP Code:
new const g_szTModel[ ] = "t_model";
new const 
g_szCTModel[ ] = "ct_model"
So basically for Terrorists the pathway would be 'cstrike/models/player/t_model/t_model.mdl'
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-03-2018 , 03:52   Re: Force T & CT player models
Reply With Quote #8

edon, I do not think you need to set models during spawn, all you have to do is set it during SetClientKeyValue and ClientUserInfoChanged.
Then you no longer need tasks.
__________________
HamletEagle is offline
Reply



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:33.


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