Raised This Month: $ Target: $400
 0% 

script c4model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-25-2007 , 04:32   script c4model
Reply With Quote #1

I maked this:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Test Change c4"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"


#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_concmd("amx_c4model","change_c4model",ADMIN_RCON,"message etc...");
}

public change_c4model(id,level,cid)
{
    if(!cmd_access(id,level,cid,2))
    return PLUGIN_HANDLED;
    
    new argv[64]
    read_argv(1,argv,63)
    
    new g_model[128]
    
    if(argv[0])
    {
        format(g_model, 127, "models/%s.mdl", argv)
    }
    
    else
    {
        copy(g_model,127,"models/w_c4.mdl")
    }
    
    new target = -1, classname[] = "func_bomb_target"
    while ((target = fm_find_ent_by_class(target, classname)))
    {
        engfunc(EngFunc_SetModel,"func_bomb_target")
    }
    
    return PLUGIN_HANDLED;
}
But doesen't change the model when i use command . It's something wrong on my code ?
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
VEN
Veteran Member
Join Date: Jan 2005
Old 02-25-2007 , 07:25   Re: script c4model
Reply With Quote #2

I do not think that you understand what you are doing.

Firstly you have to make sure that the given model are precached.

I do not see why would you want to change bomb targets' models. Be aware that its entities are invisible so your changes will not take any actual visual effect anyway.

EngFunc_SetModel accepts an entity index, not its classname. Either way such usage is very confusing. You have to read the fakemeta_const.inc before you going to start scripting using fakameta module.
VEN is offline
Reply



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 00:43.


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