Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › dod_setmodel Not Working?
7 posts, 4 people · 838 views Thread Rating: ★★★★★
closeddod_setmodel Not Working?
Started by Wilson [29th ID] on 04-21-2007, 12:21 AM
Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
04-21-2007, 12:21 AM #1

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.rnrnAm 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?rnrn

rnrn#include <amxmodx>rn#include <amxmisc>rn#include <dodx>rnrn#define PLUGIN "Class A"rn#define VERSION "1.0"rn#define AUTHOR "29th ID"rnrnnew g_isClassA[33], g_bodynum[33];rnnew g_szMdl[48] = "models/player/us-classa/us-classa.mdl";rnnew g_szMdlT[48] = "models/player/us-classa/us-classaT.mdl";rnrnpublic plugin_init() {rn	register_plugin(PLUGIN, VERSION, AUTHOR)rn	rn	register_clcmd("classa", "toggle_classa");rn}rnrnpublic plugin_precache() {rn	precache_model(g_szMdl);rn	precache_model(g_szMdlT);rn}rnrnpublic client_connect( id ) {rn	g_isClassA[id] = 0;rn}rnrnpublic toggle_classa(id) {rn	if(!g_isClassA[id])rn	{rn		dod_set_model(id, "us-classa");rn		g_isClassA[id] = 1;rn		client_print(id, print_chat, "*You are now wearing Class A");rn	}rn	elsern	{rn		dod_set_model(id, "us-inf");rn		g_isClassA[id] = 0;rn		client_print(id, print_chat, "*You are now wearing Field Uniform");rn	}rn	return PLUGIN_HANDLED;rn}rnrn
rnrnWhen I execute the client command, the server crashes, and doesn't log any errors.

H Hell Phoenix
posted here
Posts: 201
Threads: 17
Joined: Jan 2005
04-21-2007, 12:21 PM #2

This could be the problem:n ndod_set_model(id, "us-inf");ninstead of ndod_set_model(id, "us-classaT");

Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
04-21-2007, 05:30 PM #3

Hell Phoenix....I don't get it...I don't have that line of code with classaT in my plugin...whaaat?!

H Hell Phoenix
posted here
Posts: 201
Threads: 17
Joined: Jan 2005
04-21-2007, 08:28 PM #4

Your loading 2 models and only using 1 of them. Im assuming the us-inf is this model:nnew g_szMdlT[48] = "models/player/us-classa/us-classaT.mdl";n nIm saying it should be dod_set_model(id, "us-classaT");nsorry if that was confusing. Basically your loading a model you never precached by calling us-inf.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
04-21-2007, 10:20 PM #5

the "T" models are like submodels for the non "T" one that are kept in a seperate file...nnnalot 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...nnif that makes any sense

Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
04-22-2007, 12:24 AM #6

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.rnrnI remember because normally that pdata offset says "us-inf"rnrnAnd in adminmodels plugin, Zor just does dod_setmodel( id, "us-admin" ); not adminT

=|[76AD]|= TatsuSaisei
posted here
Posts: 794
Threads: 54
Joined: May 2005
04-22-2007, 12:26 AM #7
the "T" models are like submodels for the non "T" one that are kept in a seperate file...n n nalot 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...n nif that makes any sense
n nmakes 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...n nhope THAT made sense...

Archive › Old Forum Threads › Help › Scripting Help › dod_setmodel Not Working?
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC