AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   c4 model (https://forums.alliedmods.net/showthread.php?t=27750)

vincentwind 04-28-2006 11:51

c4 model
 
#include <amxmodx>
#include <fakemeta>

static const MODEL_C4[] = "models/blah/w_c4.mdl"; // edit this

public plugin_init()
{
register_plugin("test" , "0.1" , "v3x");
register_forward(FM_SetModel , "forward_setmodel");
}

public plugin_precache()
precache_model(MODEL_C4);

public forward_setmodel(entid)
{
if(!pev_valid(entid))
return FMRES_IGNORED;

new model[64];
pev(entid , pev_model , model , 63);

if(equal(model , "models/w_c4.mdl"))
{
engfunc(EngFunc_SetModel , entid , MODEL_C4);
return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

I can't see other design..........
And I want to change w_backpack.mdl
How to change ??

SubStream 05-10-2006 09:43

could you please post all of the inside of [ small ] (no spaces) so that it is easier to read?

nightscreem 05-10-2006 12:39

Quote:

Originally Posted by SubStream
could you please post all of the inside of [ small ] (no spaces) so that it is easier to read?

Code:
#include <amxmodx> #include <fakemeta> static const MODEL_C4[] = "models/blah/w_c4.mdl"; // edit this public plugin_init() { register_plugin("test" , "0.1" , "v3x"); register_forward(FM_SetModel , "forward_setmodel"); } public plugin_precache() precache_model(MODEL_C4); public forward_setmodel(entid) { if(!pev_valid(entid)) return FMRES_IGNORED; new model[64]; pev(entid , pev_model , model , 63); if(equal(model , "models/w_c4.mdl")) { engfunc(EngFunc_SetModel , entid , MODEL_C4); return FMRES_SUPERCEDE; } return FMRES_IGNORED; }

wouter 05-10-2006 12:41

Code:
public plugin_precache() precache_model(MODEL_C4);
musn't it be
Code:
public plugin_precache() { precache_model(MODEL_C4); }

SubStream 05-10-2006 14:22

Yes it should but I don't even want to respond till the person who posts it fixes there post to even be presentable... put in a [small] tag and use indentation so its at least readable to an extent.

Xanimos 05-10-2006 14:50

Quote:

Originally Posted by wouter
Code:
public plugin_precache() precache_model(MODEL_C4);
musn't it be
Code:
public plugin_precache() { precache_model(MODEL_C4); }

actually, it doesn't.

But in here
Code:
if(equal(model , "models/w_c4.mdl")) { engfunc(EngFunc_SetModel , entid , MODEL_C4); return FMRES_SUPERCEDE; }
I think you need to use the alloc string function. Don't remember the syntax off the top of my head.

SubStream 05-10-2006 15:43

Example of how to use allowcstring
Code:
g_model = engfunc ( EngFunc_AllocString, "models/w_c4.mdl" )

Xanimos 05-10-2006 15:53

then it should be like
Code:
if(equal(model , "models/w_c4.mdl")) { engfunc(EngFunc_SetModel , entid , engfunc ( EngFunc_AllocString,  MODEL_C4 ) ); return FMRES_SUPERCEDE; }

SubStream 05-10-2006 15:58

yup suicide is right on the money

VEN 05-11-2006 03:46

No, you shouldn't convert it to integer because SetModel requires a string. :|


All times are GMT -4. The time now is 05:10.

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