AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   script c4model (https://forums.alliedmods.net/showthread.php?t=51852)

SAMURAI16 02-25-2007 04:32

script c4model
 
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 ?

VEN 02-25-2007 07:25

Re: script c4model
 
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.


All times are GMT -4. The time now is 00:43.

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