Hi, trying to make a plugin that uses the concmd "amx_model <nick> <model"
This is what I have, but for some reason, when I do the command, nothing happens, but the message prints. Any idea? Please don't send me another plugin, just trying to make a plugin, not just find a plugin.
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Nikhil"
new ModelsFilePath[32]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_model", "changemodel", ADMIN_BAN, "<nick> <modelname>")
new configsDir[32]
new ModelsFile[32]
get_configsdir(configsDir,charsmax(configsDir))
format(ModelsFilePath, charsmax(ModelsFilePath), "%s/%s", configsDir, ModelsFile)
}
public plugin_precache() {
if(!file_exists(ModelsFilePath)) return PLUGIN_HANDLED
new file=fopen(ModelsFilePath, "r")
new buffer[256]
while(!feof(file))
{
fgets(file, buffer, charsmax(buffer))
precache_model(buffer)
}
fclose(file)
}
public changemodel(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new argnick[32], modelname[32]
read_argv(1, argnick, charsmax(argnick))
read_argv(2, modelname, charsmax(modelname))
new player = cmd_target(id, argnick, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
if(!player) return PLUGIN_HANDLED
new name2[32], name[32]
get_user_name(player, name2, 31)
get_user_name(id, name, 31)
cs_set_user_model(player, modelname)
client_print(0, print_chat, "Admin %s changed one of %s's model to %s", name, name2, modelname)
return PLUGIN_HANDLED
}
My models.ini:
Code:
"models/testnade.mdl"
"models/testnade2.mdl"
Btw, one of the testnades is a v_nade model and the other is a w_nade model. Maybe that's a problem? Idk.