PDA

View Full Version : dod_setmodel Not Working?


Wilson [29th ID]
04-21-2007, 01:21 AM
This plugin used to work...then one day it just stopped. Around the same time I upgraded to the new version of DoDX..which makes me think maybe that is the reason.

Am I somehow using this wrong, because I sware this used to work and I didn't change it. Or is it that the dodx module needs that native fixed?



#include <amxmodx>
#include <amxmisc>
#include <dodx>

#define PLUGIN "Class A"
#define VERSION "1.0"
#define AUTHOR "29th ID"

new g_isClassA[33], g_bodynum[33];
new g_szMdl[48] = "models/player/us-classa/us-classa.mdl";
new g_szMdlT[48] = "models/player/us-classa/us-classaT.mdl";

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("classa", "toggle_classa");
}

public plugin_precache() {
precache_model(g_szMdl);
precache_model(g_szMdlT);
}

public client_connect( id ) {
g_isClassA[id] = 0;
}

public toggle_classa(id) {
if(!g_isClassA[id])
{
dod_set_model(id, "us-classa");
g_isClassA[id] = 1;
client_print(id, print_chat, "*You are now wearing Class A");
}
else
{
dod_set_model(id, "us-inf");
g_isClassA[id] = 0;
client_print(id, print_chat, "*You are now wearing Field Uniform");
}
return PLUGIN_HANDLED;
}



When I execute the client command, the server crashes, and doesn't log any errors.

Hell Phoenix
04-21-2007, 01:21 PM
This could be the problem:

dod_set_model(id, "us-inf");
instead of
dod_set_model(id, "us-classaT");

Wilson [29th ID]
04-21-2007, 06:30 PM
Hell Phoenix....I don't get it...I don't have that line of code with classaT in my plugin...whaaat?!

Hell Phoenix
04-21-2007, 09:28 PM
Your loading 2 models and only using 1 of them. Im assuming the us-inf is this model:
new g_szMdlT[48] = "models/player/us-classa/us-classaT.mdl";

Im saying it should be dod_set_model(id, "us-classaT");
sorry if that was confusing. Basically your loading a model you never precached by calling us-inf.

diamond-optic
04-21-2007, 11:20 PM
the "T" models are like submodels for the non "T" one that are kept in a seperate file...


alot of models in the half-life.gcf file have the normal model and then the "T" submodel... you still load the non "T" model.. but it wont load unless the "T" model is present...

if that makes any sense

Wilson [29th ID]
04-22-2007, 01:24 AM
Without looking in the module's source code, I am pretty sure that the native sets the pdata offset of the player, which is somewhere between 100 and 800 if I remember correctly, to the string in the second parameter of the call.

I remember because normally that pdata offset says "us-inf"

And in adminmodels plugin, Zor just does dod_setmodel( id, "us-admin" ); not adminT

=|[76AD]|= TatsuSaisei
04-22-2007, 01:26 AM
the "T" models are like submodels for the non "T" one that are kept in a seperate file...


alot of models in the half-life.gcf file have the normal model and then the "T" submodel... you still load the non "T" model.. but it wont load unless the "T" model is present...

if that makes any sense

makes sense to me.. T model files are simply texture "containers" for a model ... usually only the player type models have them although some other "intricate" models may as well, and its a simple "flag" in the .qc file that determines if a model is compiled with textures included or in a seperate file. The T files, while having to have to be precached, do not need to be called upon, rather they are simply a dependency of the "main" model and will be "used" when the main one is...

hope THAT made sense...