Raised This Month: $138 Target: $400
 34% 

Player invisible after SetEntityModel();


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-11-2019 , 12:41   Player invisible after SetEntityModel();
Reply With Quote #1

The Model is precached but when I try to set it the player goes invisible.
Any help?
__________________
kratoss1812 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-11-2019 , 12:57   Re: Player invisible after SetEntityModel();
Reply With Quote #2

You gotta show us snippet of your code.
__________________
Taking paid private requests! Add me on steam!

Discord: Cruze#4947 | AlliedModders Releases | Github | Steam | PayPal
Cruze is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-11-2019 , 12:59   Re: Player invisible after SetEntityModel();
Reply With Quote #3

Quote:
Originally Posted by Cruze View Post
You gotta show us snippet of your code.
PHP Code:
char     T_Def1_Model[PLATFORM_MAX_PATH] = "models/player/custom_player/kodua/wb1/wb1.mdl";

public 
void OnMapStart()
{
    
AddFileToDownloadsTable(T_Def1_Model);
    
PrecacheModel(T_Def1_Modeltrue);
    

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


public 
Action OnSpawn(Handle event, const char[] namebool dontBroadcast)
{
    
int iClient GetClientOfUserId(GetEventInt(event"userid"));    
    
    if(
GetClientTeam(iClient) == CS_TEAM_T)
    {
        
CreateTimer(1.0ApplyModeliClient);
    }
}

public 
Action ApplyModel(Handle pTimerany iClient)
{
    
SetEntityModel(iClientT_Def1_Model);

__________________
kratoss1812 is offline
Ragenewb
Member
Join Date: May 2017
Location: Crashing Hale
Old 09-11-2019 , 14:00   Re: Player invisible after SetEntityModel();
Reply With Quote #4

SetEntityModel can change the hitboxes of players, instead use SetVariantString(T_Def1_Model); and AcceptEntityInput(iClient, "SetCustomModel");.

Secondly, you need to add the other model extensions to the downloads table as well (the .dx80.vtx, .phy, etc).
__________________
Over-engineering is underrated.
Ragenewb is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-11-2019 , 14:58   Re: Player invisible after SetEntityModel();
Reply With Quote #5

Quote:
Originally Posted by Ragenewb View Post
Secondly, you need to add the other model extensions to the downloads table as well (the .dx80.vtx, .phy, etc).
What if I use SM Downloader for all of those files and I just prechache the .mdl File in plugin source?
__________________
kratoss1812 is offline
Ragenewb
Member
Join Date: May 2017
Location: Crashing Hale
Old 09-11-2019 , 20:52   Re: Player invisible after SetEntityModel();
Reply With Quote #6

Quote:
Originally Posted by kratoss1812 View Post
What if I use SM Downloader for all of those files and I just prechache the .mdl File in plugin source?
That's fine. The only precache you need is the .mdl.
__________________
Over-engineering is underrated.
Ragenewb is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-12-2019 , 09:15   Re: Player invisible after SetEntityModel();
Reply With Quote #7

PHP Code:
..
        
//MODEL
        
SetEntityCustomModel(iClientT_Def1_Model);
..

void SetEntityCustomModel(int iClient, const char[] szModel)
{
    
SetVariantString(szModel);
    
AcceptEntityInput(iClient"SetCustomModel");
    
    if(
IsModelPrecached(szModel))PrintToChat(iClient"[DEBUG]Model: %s"szModel);
    else 
PrintToChat(iClient"Model not precached");

Now it donesn't change the model.. Any other help?
__________________
kratoss1812 is offline
Reply


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 02:54.


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