Raised This Month: $ Target: $400
 0% 

[CSGO] Problem with custom players model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Korake
New Member
Join Date: Jun 2018
Old 06-29-2018 , 12:53   [CSGO] Problem with custom players model
Reply With Quote #1

Hi everybody, i am writing plugin to change player model and plugin theoretically works because my character becomes a giant black box with a text "ERROR" on all sides and paths are good.

All models are downloaded while connecting to the server.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#define CTMODEL "models/player/custom_player/voikanaa/mw2/shadowcompany.mdl"

public void OnPluginStart() {
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
OnMapStart() {
    
PrecacheModel(CTMODEL);
    
AddFileToDownloadsTable("models/player/custom_player/voikanaa/mw2/shadowcompany.mdl");
    
AddFileToDownloadsTable("models/player/custom_player/voikanaa/mw2/shadowcompany.phy");
    
AddFileToDownloadsTable("models/player/custom_player/voikanaa/mw2/shadowcompany.vvd");
    
AddFileToDownloadsTable("models/player/custom_player/voikanaa/mw2/shadowcompany.dx90.vtx");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/eyes.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/eyes.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/eyes_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_head.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_head.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_head_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_headgear.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_headgear.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_headgear_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_low_body.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_low_body.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_low_body_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_smg.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_smg.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_smg_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_up_body.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_up_body.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shad_co_up_body_n.vtf");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shadow_co_visor.vmt");
    
AddFileToDownloadsTable("materials/models/player/voikanaa/mw2/shadowcompany/shadow_co_visor.vtf");
}

public 
Action:Event_PlayerSpawn(Handle eventchar[] namebool dontBroadcast) {
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
SetEntityModel(clientCTMODEL);


Korake is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-29-2018 , 15:37   Re: [CSGO] Problem with custom players model
Reply With Quote #2

First of all, your code. It's not "beutieful", eg. you include cstrike, but not even use it. You make a string called CTMODEL, but yet you only use it twice. You could actually take full advantage and use it in every function. + Only the .mdl file has to be downloaded.

2nd of. The error box isn't because of the script, it's because the model is outdated (it's broken :/).

PHP Code:
#include <sourcemod>
#include <sdktools>

#define CTMODEL "models/player/custom_player/voikanaa/mw2/shadowcompany.mdl"

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void OnMapStart()
{
    
PrecacheModel(CTMODEL);
    
    
AddFileToDownloadsTable(CTMODEL);
}

public 
Action Event_PlayerSpawn(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));
    
    
SetEntityModel(iClientCTMODEL);


Last edited by mug1wara; 06-29-2018 at 15:38.
mug1wara is offline
Korake
New Member
Join Date: Jun 2018
Old 06-29-2018 , 16:26   Re: [CSGO] Problem with custom players model
Reply With Quote #3

I added cstrike lib because i want later add models for any side.
Your code works! Thanks you very much
Korake 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 04:39.


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