AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Player invisible after SetEntityModel(); (https://forums.alliedmods.net/showthread.php?t=318638)

kratoss1812 09-11-2019 12:41

Player invisible after SetEntityModel();
 
The Model is precached but when I try to set it the player goes invisible.
Any help?

Cruze 09-11-2019 12:57

Re: Player invisible after SetEntityModel();
 
You gotta show us snippet of your code.

kratoss1812 09-11-2019 12:59

Re: Player invisible after SetEntityModel();
 
Quote:

Originally Posted by Cruze (Post 2666670)
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);



Scag 09-11-2019 14:00

Re: Player invisible after SetEntityModel();
 
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).

kratoss1812 09-11-2019 14:58

Re: Player invisible after SetEntityModel();
 
Quote:

Originally Posted by Ragenewb (Post 2666674)
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?

Scag 09-11-2019 20:52

Re: Player invisible after SetEntityModel();
 
Quote:

Originally Posted by kratoss1812 (Post 2666684)
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.

kratoss1812 09-12-2019 09:15

Re: Player invisible after SetEntityModel();
 
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?


All times are GMT -4. The time now is 01:24.

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