Opis zamieszczam w kodzie
#include <amxmodx>
#include <fakemeta>
#define VERSION "0.1"
#define fm_DispatchSpawn(%1) dllfunc(DLLFunc_Spawn, %1)
new const gszFuncBreakable[] = "func_breakable"; //KLASA DLA CREATE_ENTITY
new const gszClassname[] = "breakable_ent"; //NASZA KLASA DLA NOWEGO BYTU
new const gszModel[] = "models/breakable.mdl"; //NASZ MODEL BYTU
public plugin_init(){
register_plugin("Breakable ent", VERSION, "diablix");
register_clcmd("func_breakable", "createBreakable");
}
public plugin_precache(){
engfunc(EngFunc_PrecacheModel, gszModel); //MODEL DLA NASZEGO BYTU
engfunc(EngFunc_PrecacheModel, "models/ceilinggibs.mdl"); //MODEL DLA UZYTEGO MATERIALU (WIADOMOSCI TE_BREAKMODEL [message_const.inc])
engfunc(EngFunc_PrecacheSound, "debris/bustceiling1.wav"); //DZWIEK DLA UZYTEGO MATERIALU
engfunc(EngFunc_PrecacheSound, "debris/bustceiling2.wav");// --''--
}
public createBreakable(id){
new vOrigin[3], Float:fOrigin[3];//TWORZYMY ZMIENNE O JEDNOSTCE INT I FLOAT
get_user_origin(id, vOrigin, 3); //POBIERAMY ORIGIN NUMER 3 (WEAPON AIMING) W JEDNOSTCE INT
IVecFVec(vOrigin, fOrigin); //KONWETRUJEMY INT NA JEDNOSTKE FLOAT
new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, gszFuncBreakable)); //TWORZYMY ENT
fm_set_kvd(iEnt, "health", "400", gszFuncBreakable); //NADAJEMY HP DLA WIADOMOSCI TE_BREAKMODEL
fm_set_kvd(iEnt, "material", "4", gszFuncBreakable); //NADAJEMY TYP MATERIALU DLA WIADOMOSCI TE_BREAKMODEL
fm_DispatchSpawn(iEnt);
set_pev(iEnt, pev_classname, gszClassname); //NADAJEMY CLASSNAME
set_pev(iEnt, pev_solid, SOLID_BBOX); //NADAJEMY ZEBY BYT BYL SOLIDNY
set_pev(iEnt, pev_movetype, MOVETYPE_NONE); //USTAWIAMY TYP RUCHU
engfunc(EngFunc_SetModel, iEnt, gszModel); //USTALAMY MODEL
set_pev(iEnt, pev_size, {1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}); //USTALAMY ROZMIAR
set_pev(iEnt, pev_origin, fOrigin); //USTALAMY POZYCJE
}
//STOCK KVD (DLA SZYBSZEGO EFEKTU)
stock fm_set_kvd(entity, const key[], const value[], const classname[] = ""){
if (classname[0])
set_kvd(0, KV_ClassName, classname);
else{
new class[32];
pev(entity, pev_classname, class, sizeof class - 1);
set_kvd(0, KV_ClassName, class);
}
set_kvd(0, KV_KeyName, key);
set_kvd(0, KV_Value, value);
set_kvd(0, KV_fHandled, 0);
return dllfunc(DLLFunc_KeyValue, entity, 0);
}
Pełny spis materiałów :
material(choices) :"Material type" : "" =
[
//* <b>Gibs:</b> models/glassgibs.mdl
//* <b>Break noise:</b> debris/bustglassX.wav
//* <b>Bounce noise:</b> debris/glassX.wav
"": "Glass"
//* <b>Gibs:</b> models/woodgibs.mdl
//* <b>Break noise:</b> debris/bustcrateX.wav
//* <b>Bounce noise:</b> debris/woodX.wav
1: "Wood"
//* <b>Gibs:</b> models/metalplategibs.mdl
//* <b>Break noise:</b> debris/bustmetalX.wav
//* <b>Bounce noise:</b> debris/metalX.wav
2: "Metal"
//* <b>Gibs:</b> models/fleshgibs.mdl
//* <b>Break noise:</b> debris/bustfleshX.wav
//* <b>Bounce noise:</b> debris/fleshX.wav
3: "Flesh"
//* <b>Gibs:</b> models/cindergibs.mdl
//* <b>Break noise:</b> debris/bustconcreteX.wav
//* <b>Bounce noise:</b> debris/concreteX.wav
4: "Cinder Block"
//* <b>Gibs:</b> models/ceilinggibs.mdl
//* <b>Break noise:</b> debris/bustceilingX.wav
//* <b>Bounce noise:</b> none
5: "Ceiling Tile"
//* <b>Gibs:</b> models/computergibs.mdl
//* <b>Break noise:</b> debris/bustmetalX.wav
//* <b>Bounce noise:</b> debris/woodX.wav
//* <b>Note:</b> Generates sparks when damaged.
6: "Computer"
//* <b>Gibs:</b> models/glassgibs.mdl
//* <b>Break noise:</b> debris/bustglassX.wav
//* <b>Bounce noise:</b> debris/glassX.wav
//* <b>Note:</b> Makes ricochet noises when damaged.
7: "Unbreakable Glass"
//* <b>Gibs:</b> models/rockgibs.mdl
//* <b>Break noise:</b> debris/bustconcreteX.wav
//* <b>Bounce noise:</b> debris/concreteX.wav
8: "Rocks"
]
Użytkownik diablix edytował ten post 13.04.2011 01:04