GORILA *Administrator*


Data inscrierii: 19/Mai/2007 Mesaje: 396 Localitate: Barlad
|
Trimis: 01/05/2008 16:32 Titlul subiectului: Plugin arme ! (tutorial) |
|
|
First of all u need to download your custom weapon model(includes C4 and NO CUSTOM HANDS MODEL!!!).Good place where u can find some models is here:FPS Banana
After u downloaded the model unzip it and make a new .sma and rename it to anything u like.
I will use: custom_P90.sma because my tip is this: Image
Open your .sma and write:
Code:
#include <amxmodx>
#include <fakemeta>
to "declare" all of your included .inc files
The write:
Code:
#define V_MODEL "models/v_new_p90.mdl"
#define W_MODEL "models/w_new_p90.mdl"
#define P_MODEL "models/p_new_p90.mdl"
where:
Code:
V_MODEL "models/v_new_p90.mdl"
has in " " the location and name and extension of your v_ model
this is for what the player sees when he is holding the gun
Code:
W_MODEL "models/w_new_p90.mdl"
has in " " the location and name and extension of your w_ model
this is for what the player sees the gun on the ground
Code:
P_MODEL "models/p_new_p90.mdl"
has in " " the location and name and extension of your p_ model
this is for what the player sees when another players hold that gun
Code:
#define P90_W_MODEL "models/w_p90.mdl"
this is the old name for the old model
Code:
public plugin_init()
{
register_plugin("Custom P90","1.0","Hack")
// HL Event CurWeapon
register_event("CurWeapon", "Event_CurWeapon", "be","1=1");
// FM_SetModel Fakemeta forward
register_forward(FM_SetModel,"fw_setmodel"/*,1*/);
}
Declare the plugin and leave unchanged except:
Code:
register_plugin("Custom P90","1.0","Hack")
where u type between brackets the Name,version,author of this plugin
Code:
public plugin_precache()
{
// precache the required models
engfunc(EngFunc_PrecacheModel,V_MODEL);
engfunc(EngFunc_PrecacheModel,P_MODEL);
engfunc(EngFunc_PrecacheModel,W_MODEL);
}
Precache the usefull models for this plugin leave unchanged
Code:
public Event_CurWeapon(id)
{
new weaponID = read_data(2);
if(weaponID != CSW_P90)
return PLUGIN_CONTINUE;
set_pev(id, pev_viewmodel2, V_MODEL);
set_pev(id, pev_weaponmodel2, P_MODEL);
return PLUGIN_CONTINUE;
}
If u only have/want a view model delete the line
Code:
set_pev(id, pev_weaponmodel2, P_MODEL);
and skip the next step!
change this line:
Code:
if(weaponID != CSW_P90)
to
Code:
if(weaponID != CSW_WEAPON_NAME)
the CSW_WEAPON_NAME represents the weapon id and can be found here
Code:
public fw_setmodel(ent,const model[])
{
// if isn't w_p90 model
if(strcmp(P90_W_MODEL,model) )
return FMRES_IGNORED;
// get ent classname
static classname[32]
pev(ent,pev_classname,classname,31);
if(!strcmp(classname, "weaponbox") || !strcmp(classname, "armoury_entity") || !strcmp(classname, "grenade"))
{
// set model
engfunc(EngFunc_SetModel, ent, W_MODEL);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
change only the P90_
Code:
if(strcmp(P90_W_MODEL,model) )
with the name that u used here:
Code:
#define P90_W_MODEL "models/w_p90.mdl" _________________

Ultima modificare efectuata GORILA la 20/05/2008 11:39, modificat de 3 ori in total |
|