Raised This Month: $95 Target: $400
 23% 

[TF2] prop_ragdoll keeps crashing my game even with a model set.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowysn
Senior Member
Join Date: Sep 2015
Old 10-06-2019 , 05:29   [TF2] prop_ragdoll keeps crashing my game even with a model set.
Reply With Quote #1

If I spawn a prop_ragdoll using the console:
ent_create prop_ragdoll model "models/player/spy.mdl"
...the game won't crash and the ragdoll is spawned.
However, if I do it in Sourcemod, even ensuring it's model is set... it crashes.
PHP Code:
    float pos[3];
    
float ang[3];
    
GetClientAbsOrigin(clientpos);
    
GetClientAbsAngles(clientang);
    
    
char clientModel[64];
    
GetClientModel(clientclientModelsizeof(clientModel));
    
//char add_output_model[32];
    //Format(add_output_model, sizeof(add_output_model), "model %s", clientModel);
    
    //if (!IsModelPrecached(clientModel))
    //{ PrecacheModel(clientModel); }
    //PrintToChatAll(clientModel);
    
    
int rag CreateEntityByName("physics_prop_ragdoll");
    if(
rag 1)
    { return; }
    
AcceptEntityInput(ragdoll"kill");
    
    
//SetEntProp(rag, Prop_Send, "m_nModelIndex", GetEntProp(client, Prop_Send, "m_nModelIndex"))
    //DispatchKeyValue(rag, "model", clientModel);
    //SetVariantString(add_output_model);
    //AcceptEntityInput(rag, "AddOutput");
    
SetEntityModel(ragclientModel);
    
TeleportEntity(ragposangNULL_VECTOR);
    
    
char value[32];
    
IntToString(GetEntProp(clientProp_Send"m_nSkin"), valuesizeof(value));
    
DispatchKeyValue(rag"skin"value);
    
    
IntToString(GetEntProp(clientProp_Send"m_nBody"), valuesizeof(value));
    
DispatchKeyValue(rag"body"value);
    
    
IntToString(8192valuesizeof(value));
    
DispatchKeyValue(rag"spawnflags"value);
    
    
DispatchSpawn(rag);
    
ActivateEntity(rag);
    
    
SetEdictFlags(ragFL_EDICT_DONTSEND);
    
    
SetVariantString("OnUser1 !self:Kill::15.0:1");
    
AcceptEntityInput(rag"AddOutput");
    
AcceptEntityInput(rag"FireUser1"); 
Spawning a prop_dynamic instead of the ragdoll revealed that the model should be set properly.
As I cannot even debug if my game crashes straightaway after the problem, plus seeing how a plugin that spawned prop_ragdolls worked in another game, (and following that plugin's code still crashes in TF2) I have no idea what to do next.

Why do I want server-sided ragdolls? Well, it was just a little experiment I wanted to conduct.

Last edited by Shadowysn; 10-17-2019 at 03:51.
Shadowysn is offline
Nanochip
Senior Member
Join Date: Jan 2014
Old 10-08-2019 , 13:10   Re: [TF2] prop_ragdoll keeps crashing my game even with a model set.
Reply With Quote #2

For TF2, use the entity tf_ragdoll.
__________________
Nanochip is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Old 10-11-2019 , 13:19   Re: [TF2] prop_ragdoll keeps crashing my game even with a model set.
Reply With Quote #3

Quote:
Originally Posted by Nanochip View Post
For TF2, use the entity tf_ragdoll.
I already knew that, I was just experimenting with a rather-pretty-useless feature of forcing server-sided ragdolls.

Dangit, I should've made it more clear. I always manage to forget about info, info, and more info.
Shadowysn is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Brexit
Old 10-16-2019 , 17:32   Re: [TF2] prop_ragdoll keeps crashing my game even with a model set.
Reply With Quote #4

Have you tried not creating a "physics_prop_ragdoll" instead use the entity you are using with this command (ent_create prop_ragdoll model "models/player/spy.mdl")

PHP Code:
int rag CreateEntityByName("prop_ragdoll"); 
Also dunno if you intended to not transmit the entity you may wanna remove that line.
PHP Code:
SetEdictFlags(ragFL_EDICT_DONTSEND); 
__________________
Lux is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Old 10-17-2019 , 03:48   Re: [TF2] prop_ragdoll keeps crashing my game even with a model set.
Reply With Quote #5

Quote:
Originally Posted by Lux View Post
Have you tried not creating a "physics_prop_ragdoll" instead use the entity you are using with this command (ent_create prop_ragdoll model "models/player/spy.mdl")

PHP Code:
int rag CreateEntityByName("prop_ragdoll"); 
Also dunno if you intended to not transmit the entity you may wanna remove that line.
PHP Code:
SetEdictFlags(ragFL_EDICT_DONTSEND); 
I actually took those from your code
I initially went with prop_ragdoll and didn't include that SetEdictFlags in my code, but they didn't work. Fast-forward to using those bits of code, and it still hasn't solved the problem.
__________________
ragdoll spam, that is all
Shadowysn 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 08:47.


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