Raised This Month: $51 Target: $400
 12% 

Change model of a client - models do not move?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Gh05t~
Member
Join Date: Oct 2007
Old 04-29-2009 , 05:14   Change model of a client - models do not move?
Reply With Quote #1

Hello.
I just tried to change the model of a player. Heres some code:
PHP Code:
#define MYMODEL "models/characters/counterterrorist.mdl"
public OnMapStart()
{
    
PrecacheModel(MYMODELtrue);
}

// Player_spawn hook
public Action:EventPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if(
IsModelPrecached(MYMODEL)) SetEntityModel(clientMYMODEL);

Ive also tried
PHP Code:
new modelindex PrecacheModel(MYMODELtrue);
...
new 
offset FindSendPropOffs("CBaseEntity""m_nModelIndex");
SetEntData(clientoffsetmodelindex4true); 
Both solutions work, but the models animations do not work, they are running arround as if they are crucified . Probably iam missing something, can somebody help me out?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
paegus
Senior Member
Join Date: Nov 2004
Location: Extreme low earth orbit
Old 04-29-2009 , 05:24   Re: Change model of a client - models do not move?
Reply With Quote #2

you need to make sure the model you're using is rigged in the same way as the player's original model otherwise the animations wont match and you'll get some default animation... aka the Vitruvian pose.

chances are you're using a ragdoll model instead of an actual player one?
__________________
Live and learn or die and teach by example.
Plugins Mine | Hidden:SourceMod
paegus is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 04-29-2009 , 14:45   Re: Change model of a client - models do not move?
Reply With Quote #3

iam using exactly that one mentioned above. Its implemented in srcds-cstrike-server. What models can i use? Is it possible to use any models from hl2 (in my case: for cstrike mod)?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
paegus
Senior Member
Join Date: Nov 2004
Location: Extreme low earth orbit
Old 04-30-2009 , 05:04   Re: Change model of a client - models do not move?
Reply With Quote #4

player-compatible models are usually in models/player/ though aren't they?

e: and you can only use models that are rigged in the same way (same animations, in the same order). models compiled for hl2dm, for example, aren't arranged in the same way. you might not end up with the Vitruvian pose but it still wont work properly.
__________________
Live and learn or die and teach by example.
Plugins Mine | Hidden:SourceMod

Last edited by paegus; 04-30-2009 at 05:34.
paegus is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 05-01-2009 , 07:51   Re: Change model of a client - models do not move?
Reply With Quote #5

Ah, ok. Models from models/player/ work perfect.
Would it be possible to use HL2 models in cstrike if i had the related animations for cstrike?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
paegus
Senior Member
Join Date: Nov 2004
Location: Extreme low earth orbit
Old 05-01-2009 , 09:11   Re: Change model of a client - models do not move?
Reply With Quote #6

if you re-rig the models to use CSS skeleton, hitboxes, animations and whatnot then yes you can use the HL2 models... but they'll need to be downloaded by the players first.
__________________
Live and learn or die and teach by example.
Plugins Mine | Hidden:SourceMod
paegus 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 06:08.


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