View Full Version : Simpler Admin Model Plugin
MrShadow
10-08-2007, 02:45 PM
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:
#include <amxmodx>
#include <amxmisc>
#include <dodx>
public plugin_init() {
register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_model("models/player/admin-allies/admin-allies.mdl")
precache_model("models/player/admin-axis/admin-axis.mdl")
return PLUGIN_CONTINUE
}
public dod_client_changeteam(id, team, oldteam) {
if (get_user_flags(id) & ADMIN_KICK) {
if (team == AXIS) {
dod_set_model(id, "admin-axis")
}
else if(team == ALLIES) {
dod_set_model(id, "admin-allies")
}
}
return PLUGIN_CONTINUE
}
Help would be much appreciated, i don't know if this forum is dead or not...
FeuerSturm
10-08-2007, 03:19 PM
the forum isn't dead, at least not completely :rolleyes:
i would suggest to take a look at Zor's Admin Models plugin
to see how you have to set the model correctly!
setting the model to "admin-axis" doesn't work because there is no
model called "admin-axis". like i said, please take a closer look at Zor's plugin
and i'm sure you will see what's wrong.
if you still can't get it to work then, i'd gladly point you to the lines that
are wrong, but i'd rather like to encourage you to look for the fault than
just correcting it.
i already gave you the hint, just look for the dod_set_model native in
Zor's code :rolleyes:
MrShadow
10-08-2007, 04:32 PM
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 :)
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <dodx>
#define MODELS 4
new models[MODELS][128] =
{
"models/player/admin-allies/admin-allies.mdl",
"models/player/admin-allies/admin-alliesT.mdl",
"models/player/admin-axis/admin-axis.mdl",
"models/player/admin-axis/admin-axisT.mdl"
}
new models_type[2][32] =
{
"admin-allies",
"admin-axis"
}
new g_dod_am_enabled
public plugin_init() {
register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")
g_dod_am_enabled = register_cvar("dod_am_enabled", "1")
return PLUGIN_CONTINUE
}
public plugin_precache()
{
for(new x = 0; x < MODELS; x++)
{
if(!file_exists(models[x]))
{
log_amx("File: %s Does not Exist, Disabling plugin!", models[x])
set_pcvar_num(g_dod_am_enabled, 0)
return PLUGIN_CONTINUE
}
precache_model(models[x])
enforce(models[x])
}
precache_model("models/rpgrocket.mdl")
return PLUGIN_CONTINUE
}
public dod_client_changeteam(id, team, oldteam)
{
if(!is_user_connected(id) || !get_pcvar_num(g_dod_am_enabled))
return PLUGIN_CONTINUE
if(get_user_flags(id)&ADMIN_LEVEL_H)
{
if(team == ALLIES || team == AXIS)
dod_set_model(id, models_type[team-1])
}
return PLUGIN_CONTINUE
}
public fw_precache(const file[])
{
enforce(file)
return FMRES_IGNORED
}
public enforce(const file[])
{
force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, file)
}
public inconsistent_file(id, const filename[], reason[64])
{
format(reason, 63, "Delete %s and reconnect to get proper file!", filename)
return PLUGIN_CONTINUE
}
diamond-optic
10-08-2007, 05:12 PM
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..
#include <amxmodx>
#include <dodx>
public plugin_init()
{
register_plugin("AvaMods Player Models", "1.0", "diamond-optic")
register_cvar("avamods_playermodel_stats", "1.0", FCVAR_SERVER|FCVAR_SPONLY)
register_event("TextMsg","change_hook","b","1=3","2=#game_respawn_as", "2=#game_spawn_as", "3=#class_brit_light")
register_event("TextMsg","reset_hook","b","1=3","2=#game_respawn_as", "2=#game_spawn_as", "3!#class_brit_light")
register_message(get_user_msgid("PTeam"), "teamswitch_hook")
}
public change_hook(id)
{
dod_set_model(id,"us-para")
dod_set_body_number(id,0)
}
public reset_hook(id)
{
dod_clear_model(id)
}
public teamswitch_hook()
{
new id = get_msg_arg_int(1)
new team = get_msg_arg_int(2)
if(team == AXIS && is_user_connected(id))
dod_clear_model(id)
}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 lol
and looking at your code real quickly.. it looks like it should work.. ill try it in a minute and post again
diamond-optic
10-08-2007, 05:27 PM
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 right
i tried hooking the PTeam message and its working fine now
#include <amxmodx>
#include <dodx>
public plugin_init()
{
register_plugin("Dod Admin Models 2", "1.0", "Mr.Shadow")
register_message(get_user_msgid("PTeam"), "teamswitch_hook")
}
public plugin_precache()
{
precache_model("models/player/admin-allies/admin-allies.mdl")
precache_model("models/player/admin-axis/admin-axis.mdl")
}
public teamswitch_hook()
{
new id = get_msg_arg_int(1)
new team = get_msg_arg_int(2)
if(get_user_flags(id) & ADMIN_KICK)
{
if(team == AXIS)
dod_set_model(id, "admin-axis")
else if(team == ALLIES)
dod_set_model(id, "admin-allies")
}
}
Wilson [29th ID]
10-08-2007, 09:49 PM
You should still have to precache the T models. It shouldn't work without those...
Then like this Wilson?
public plugin_precache()
{
precache_model("models/player/admin-allies/admin-allies.mdl")
precache_model("models/player/admin-allies/admin-alliesT.mdl")
precache_model("models/player/admin-axis/admin-axis.mdl")
precache_model("models/player/admin-axis/admin-axisT.mdl")
}
Btw the folder called "player" in models can that be changed, so pbl will DL the right models??
Wilson [29th ID]
12-26-2007, 03:22 PM
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.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.