Raised This Month: $ Target: $400
 0% 

amx_model help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-25-2010 , 00:34   amx_model help
Reply With Quote #1

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.

Last edited by nikhilgupta345; 08-25-2010 at 00:36.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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