Raised This Month: $ Target: $400
 0% 

[CSS] Can we still change player models?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
D.Moder
I uploaded 2 great gameplay plugins here
Join Date: Sep 2009
Location: Sin city
Old 01-06-2017 , 05:10   Re: [CSS] Can we still change player models?
Reply With Quote #3

here is a solution I found, or I should say it's a simplified version of sm_skinchooser for CSS only:

add this code to your plugin:

PHP Code:
#define MAX_FILE_LEN 256
#define MAX_MODELS 48

new g_ModelsPlayer_Count;
new 
String:g_ModelsPlayer[MAX_MODELS][MAX_FILE_LEN];


public 
OnMapStart()
{
    
g_ModelsPlayer_Count LoadModels(g_ModelsPlayer"configs/skin_downloads.ini");
}


stock bool:SetModelIndex(clientindex)
{
    if (
g_ModelsPlayer_Count && index >= && index g_ModelsPlayer_Count)
    {
        
SetEntityModel(clientg_ModelsPlayer[index]);
        return 
true;
    }
    return 
false;
}


stock LoadModels(String:models[][], String:ini_file[])
{
    
decl String:buffer[MAX_FILE_LEN];
    
decl String:file[MAX_FILE_LEN];
    new 
models_count;
    
    
BuildPath(Path_SMfileMAX_FILE_LENini_file);
    
    
//open precache file and add everything to download table
    
new Handle:fileh OpenFile(file"r");
    if (
fileh)
    {
        while (
ReadFileLine(filehbufferMAX_FILE_LEN))
        {
            
// Strip leading and trailing whitespace
            
TrimString(buffer);
            
            
// Skip non existing files (and Comments)
            
if (FileExists(buffer true))
            {
                
// Tell Clients to download files
                
AddFileToDownloadsTable(buffer);
                
// Tell Clients to cache model
                
if (StrEqual(buffer[strlen(buffer)-4], ".mdl"false) && (models_count MODELS_PER_TEAM))
                {
                    
strcopy(models[models_count++], strlen(buffer)+1buffer);
                    
PrecacheModel(buffertrue);
                }
            }
        }
        
CloseHandle(fileh);
    }
    else
    {
        
PrintToServer("LoadModels: File not found '%s'"file);
    }
    return 
models_count;

then
1. create a file named 'skin_downloads.ini' in 'css_server\cstrike\addons\sourcemod\configs' folder
2. now you can add your skins paths to .ini file
example:
PHP Code:
models/player/stenli/Lilith.phy 
models
/player/stenli/Lilith.sw.vtx 
models
/player/stenli/lilith.vvd 
models
/player/stenli/Lilith.dx80.vtx 
models
/player/stenli/Lilith.dx90.vtx 
models
/player/stenli/lilith.mdl 
materials
/models/player/stenli/Lilith/lilith_head_n.vtf 
materials
/models/player/stenli/Lilith/lilith_body.vmt 
materials
/models/player/stenli/Lilith/lilith_body.vtf 
materials
/models/player/stenli/Lilith/lilith_body_2.vmt 
materials
/models/player/stenli/Lilith/lilith_body_n.vtf 
materials
/models/player/stenli/Lilith/lilith_head.vmt 
materials
/models/player/stenli/Lilith/lilith_head.vtf 
materials
/models/player/stenli/Lilith/lilith_head_2.vmt 
and here is the model file I downloaded and used:
http://gamebanana.com/skins/127743
__________________
Creator of COD-Life (Half COD, Half Life)
https://forums.alliedmods.net/showthread.php?t=261162
twitter: @D_Moder_61216

Last edited by D.Moder; 01-06-2017 at 05:54. Reason: improved LoadModels
D.Moder is offline
 


Thread Tools
Display Modes

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 06:04.


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