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 › Simpler Admin Model Plugin
8 posts, 5 people · 1,640 views Thread Rating: ★★★★★
closedSimpler Admin Model Plugin
Started by MrShadow on 10-08-2007, 01:45 PM
M MrShadow
started this thread
Posts: 3
Threads: 2
Joined: Oct 2007
10-08-2007, 01:45 PM #1

Hey, i'm a complete beginner to amxx scripting and i need some help. I wanted to create a simpler admin model plugin for dod. One without the third person and body number thing. I would like to know what is wrong with the code in my version:rnrn

#include <amxmodx>rn#include <amxmisc>rn#include <dodx>rnrnpublic plugin_init() {rn        register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")rn        return PLUGIN_CONTINUErn}rnrnpublic plugin_precache() {rn        precache_model("models/player/admin-allies/admin-allies.mdl")rn        precache_model("models/player/admin-axis/admin-axis.mdl")rnrn        return PLUGIN_CONTINUErn}rnrnpublic dod_client_changeteam(id, team, oldteam) {rn        if (get_user_flags(id) & ADMIN_KICK) {rn                if (team == AXIS) {rn                        dod_set_model(id, "admin-axis")rn                }rn                else if(team == ALLIES) {rn                        dod_set_model(id, "admin-allies")rn                }rn        }rnrn        return PLUGIN_CONTINUErn}
rnrnHelp would be much appreciated, i don't know if this forum is dead or not...

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
10-08-2007, 02:19 PM #2

the forum isn't dead, at least not completely :rolleyes: rnrni would suggest to take a look at Zor's Admin Models pluginrnto see how you have to set the model correctly!rnrnsetting the model to "admin-axis" doesn't work because there is nornmodel called "admin-axis". like i said, please take a closer look at Zor's pluginrnand i'm sure you will see what's wrong.rnrnif you still can't get it to work then, i'd gladly point you to the lines thatrnare wrong, but i'd rather like to encourage you to look for the fault thanrnjust correcting it.rnrni already gave you the hint, just look for the dod_set_model native inrnZor's code :rolleyes:

M MrShadow
started this thread
Posts: 3
Threads: 2
Joined: Oct 2007
10-08-2007, 03:32 PM #3

ok, i looked at zor's plugin and basically copied some of the script right out of it, it still doesn't work though. if you could point me in the right direction, i'd appreciate it :)rnrn

#include <amxmodx>rn#include <amxmisc>rn#include <engine>rn#include <fakemeta>rn#include <dodx>rnrn#define MODELS 4rnnew models[MODELS][128] =rn{rn	"models/player/admin-allies/admin-allies.mdl",rn	"models/player/admin-allies/admin-alliesT.mdl",rn	"models/player/admin-axis/admin-axis.mdl",rn	"models/player/admin-axis/admin-axisT.mdl"rn}rnrnnew models_type[2][32] =rn{rn	"admin-allies",rn	"admin-axis"rn}rnrnnew g_dod_am_enabledrnrnrnpublic plugin_init() {rn	register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")rn	g_dod_am_enabled = register_cvar("dod_am_enabled", "1")rn	return PLUGIN_CONTINUErn}rnrnpublic plugin_precache()rn{rn	for(new x = 0; x < MODELS; x++)rn	{rn		if(!file_exists(models[x]))rn		{rn			log_amx("File: %s Does not Exist, Disabling plugin!", models[x])rn			set_pcvar_num(g_dod_am_enabled, 0)rnrn			return PLUGIN_CONTINUErn		}rn	rn		precache_model(models[x])rn		enforce(models[x])rn	}rn	rn	precache_model("models/rpgrocket.mdl")rn	rn	return PLUGIN_CONTINUErn}rnrnpublic dod_client_changeteam(id, team, oldteam)rn{rn	if(!is_user_connected(id) || !get_pcvar_num(g_dod_am_enabled))rn		return PLUGIN_CONTINUErnrn	if(get_user_flags(id)&ADMIN_LEVEL_H)rn	{rn		if(team == ALLIES || team == AXIS)rn			dod_set_model(id, models_type[team-1])rn	}rn		rn	return PLUGIN_CONTINUErn}rnrnpublic fw_precache(const file[]) rn{rn	enforce(file)rn	return FMRES_IGNOREDrn}  rnrnpublic enforce(const file[])rn{rn	force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, file)rn}rnrnpublic inconsistent_file(id, const filename[], reason[64])rn{rn	format(reason, 63, "Delete %s and reconnect to get proper file!", filename)rn	return PLUGIN_CONTINUErn}
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
10-08-2007, 04:12 PM #4

dont know if it will help any.. but heres the code im using on my server to make british light class (enfield) use the allies para model..nn

#include <amxmodx>n#include <dodx>nnnpublic plugin_init()n{n    register_plugin("AvaMods Player Models", "1.0", "diamond-optic")n    register_cvar("avamods_playermodel_stats", "1.0", FCVAR_SERVER|FCVAR_SPONLY)n    n    register_event("TextMsg","change_hook","b","1=3","2=#game_respawn_as", "2=#game_spawn_as", "3=#class_brit_light")n    register_event("TextMsg","reset_hook","b","1=3","2=#game_respawn_as", "2=#game_spawn_as", "3!#class_brit_light")nn    register_message(get_user_msgid("PTeam"), "teamswitch_hook")n}nnpublic change_hook(id)n{n    dod_set_model(id,"us-para")n    dod_set_body_number(id,0)    n}nnpublic reset_hook(id)n{n    dod_clear_model(id)n}nnpublic teamswitch_hook()n{n    new id = get_msg_arg_int(1)n    new team = get_msg_arg_int(2)n        n    if(team == AXIS && is_user_connected(id))n        dod_clear_model(id)n}
i know what im doing is probably a bit more specific then what your trying to do but maybe theres something there that will help.. i had trouble getting player models to change at 1st myself if that helps your confidence any lolnnand looking at your code real quickly.. it looks like it should work.. ill try it in a minute and post again

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

ok i think the problem is with the dod changeteam forward.. i think i had a similar problem when i originally tried getting the above plugin to work rightnni tried hooking the PTeam message and its working fine nownn

#include <amxmodx>n#include <dodx>nnpublic plugin_init()n{n    register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")n    n    register_message(get_user_msgid("PTeam"), "teamswitch_hook")n}nnpublic plugin_precache() n{n    precache_model("models/player/admin-allies/admin-allies.mdl")n    precache_model("models/player/admin-axis/admin-axis.mdl")n}nnpublic teamswitch_hook()n{n    new id = get_msg_arg_int(1)n    new team = get_msg_arg_int(2)nn    if(get_user_flags(id) & ADMIN_KICK) n        {n        if(team == AXIS)n              dod_set_model(id, "admin-axis")n        else if(team == ALLIES)n              dod_set_model(id, "admin-allies")n        }n}
Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
10-08-2007, 08:49 PM #6

You should still have to precache the T models. It shouldn't work without those...

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
12-26-2007, 10:35 AM #7

Then like this Wilson?rnrn

rnpublic plugin_precache() rn{    rnrnprecache_model("models/player/admin-allies/admin-allies.mdl") rnprecache_model("models/player/admin-allies/admin-alliesT.mdl")rnprecache_model("models/player/admin-axis/admin-axis.mdl")rnprecache_model("models/player/admin-axis/admin-axisT.mdl")rnrn}
rnrnBtw the folder called "player" in models can that be changed, so pbl will DL the right models??

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
12-26-2007, 03:22 PM #8

You also have to precache that rocket model for some reason. Look at dod admin models he precaches it there. Otherwise it won't work if I remember correctly.

Archive › Old Forum Threads › Help › Scripting Help › Simpler Admin Model Plugin
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC