AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_model help (https://forums.alliedmods.net/showthread.php?t=136303)

nikhilgupta345 08-25-2010 00:34

amx_model help
 
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.

kaizer66 09-05-2013 05:03

Re: amx_model help
 
Ask exolent

DWIGHTpN 09-05-2013 05:28

Re: amx_model help
 
Use cs_reset_user_model(index);, before cs_set_user_model.

dark_style 09-05-2013 07:42

Re: amx_model help
 
Guys, the thread is on 3 years, I am sure he has found the solution so far. It wasn't needed to revive this old thread.


All times are GMT -4. The time now is 22:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.