But then I won't be able to rotate the model, I mean entity_set_vector (ent, EV_VEC_angles, angles); Truth ?faken, possible also by bsp-brush collision
#include <amxmodx>
#include <fakemeta>
#include <reapi>
#pragma semicolon 1
#define DROP
#define MODEL "models/model.mdl" //u model
new Float: g_fLastAction[MAX_PLAYERS + 1] = { 0.0, ... };
public plugin_precache() {
precache_model(MODEL);
}
public plugin_init() {
register_clcmd("set_entity", "clcmd_action");
}
public clcmd_action(id) {
new wtf = rg_create_entity("info_target");
if (is_nullent(wtf)) {
return;
}
set_entvar(wtf, var_classname, "wtf");
set_entvar(wtf, var_solid, SOLID_BBOX);
set_entvar(wtf, var_movetype, MOVETYPE_NONE);
engfunc(EngFunc_SetModel, wtf, MODEL);
engfunc(EngFunc_SetSize, wtf, { -30.0, -30.0, 5.0 }, { 30.0, 30.0, 5.0 });
new Float: origin[3];
fm_get_aim_origin(id, origin);
engfunc(EngFunc_SetOrigin, origin);
#if defined DROP
engfunc(EngFunc_DropToFloor, wtf);
#endif
SetTouch(wtf, "touch_callback");
}
public touch_callback(const ent, const other) {
if (0 > other > MaxClients || !is_user_alive(other)) {
SetTouch(ent, "");
return;
}
if (g_fLastAction[other] > get_gametime()) {
client_print(other, print_center, "*touched*");
g_fLastAction[other] = get_gametime() + 2.0;
}
}
//fakemeta util
stock fm_get_aim_origin(index, Float:origin[3]) {
new Float:start[3], Float:view_ofs[3];
pev(index, pev_origin, start);
pev(index, pev_view_ofs, view_ofs);
UTIL_VecAdd(start, view_ofs, start);
new Float:dest[3];
pev(index, pev_v_angle, dest);
engfunc(EngFunc_MakeVectors, dest);
global_get(glb_v_forward, dest);
UTIL_VecMulScalar(dest, 9999.0, dest);
UTIL_VecAdd(start, dest, dest);
engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
get_tr2(0, TR_vecEndPos, origin);
return 1;
}
stock UTIL_VecAdd(const Float: fVectorA[3], const Float: fVectorB[3], Float: fOut[3]) {
fOut[0] = fVectorA[0] + fVectorB[0];
fOut[1] = fVectorA[1] + fVectorB[1];
fOut[2] = fVectorA[2] + fVectorB[2];
}
stock UTIL_VecMulScalar(const Float: fVector[3], const Float: fScalar, Float: fOut[3]) {
fOut[0] = fVector[0] * fScalar;
fOut[1] = fVector[1] * fScalar;
fOut[2] = fVector[2] * fScalar;
}
Not working, hitbox is still cuboid. I want a wheel like in a movie. I think it is impossible, only $flags 512 in model. But if I create too many such models, the FPS drops ...faken,Код:#include <amxmodx> #include <fakemeta> #include <reapi> #pragma semicolon 1 #define DROP #define MODEL "models/model.mdl" //u model new Float: g_fLastAction[MAX_PLAYERS + 1] = { 0.0, ... }; public plugin_precache() { precache_model(MODEL); } public plugin_init() { register_clcmd("set_entity", "clcmd_action"); } public clcmd_action(id) { new wtf = rg_create_entity("info_target"); if (is_nullent(wtf)) { return; } set_entvar(wtf, var_classname, "wtf"); set_entvar(wtf, var_solid, SOLID_BBOX); set_entvar(wtf, var_movetype, MOVETYPE_NONE); engfunc(EngFunc_SetModel, wtf, MODEL); engfunc(EngFunc_SetSize, wtf, { -30.0, -30.0, 5.0 }, { 30.0, 30.0, 5.0 }); new Float: origin[3]; fm_get_aim_origin(id, origin); engfunc(EngFunc_SetOrigin, origin); #if defined DROP engfunc(EngFunc_DropToFloor, wtf); #endif SetTouch(wtf, "touch_callback"); } public touch_callback(const ent, const other) { if (0 > other > MaxClients || !is_user_alive(other)) { SetTouch(ent, ""); return; } if (g_fLastAction[other] > get_gametime()) { client_print(other, print_center, "*touched*"); g_fLastAction[other] = get_gametime() + 2.0; } } //fakemeta util stock fm_get_aim_origin(index, Float:origin[3]) { new Float:start[3], Float:view_ofs[3]; pev(index, pev_origin, start); pev(index, pev_view_ofs, view_ofs); UTIL_VecAdd(start, view_ofs, start); new Float:dest[3]; pev(index, pev_v_angle, dest); engfunc(EngFunc_MakeVectors, dest); global_get(glb_v_forward, dest); UTIL_VecMulScalar(dest, 9999.0, dest); UTIL_VecAdd(start, dest, dest); engfunc(EngFunc_TraceLine, start, dest, 0, index, 0); get_tr2(0, TR_vecEndPos, origin); return 1; } stock UTIL_VecAdd(const Float: fVectorA[3], const Float: fVectorB[3], Float: fOut[3]) { fOut[0] = fVectorA[0] + fVectorB[0]; fOut[1] = fVectorA[1] + fVectorB[1]; fOut[2] = fVectorA[2] + fVectorB[2]; } stock UTIL_VecMulScalar(const Float: fVector[3], const Float: fScalar, Float: fOut[3]) { fOut[0] = fVector[0] * fScalar; fOut[1] = fVector[1] * fScalar; fOut[2] = fVector[2] * fScalar; }
I did something like this:faken Create bsp model in editor and use it. Yes you can rotate, move model etc.
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
enum _:Wut{
BSP,
MDL
};
new g_sWut[Wut][0xE] = {
"maps/x.bsp",
"models/x.mdl"
};
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("create", "_Stworz");
}
public plugin_precache() {
for(new i ; i < Wut ; i++) precache_model(g_sWut[i]);
}
public _Stworz(id){
new Float:fOrigin[0x3];
entity_get_vector(id, EV_VEC_origin, fOrigin);
fOrigin[0x2]-=36.0;
new iEnt = create_entity("func_wall");
entity_set_origin(iEnt, fOrigin);
entity_set_int(iEnt, EV_INT_movetype, 0x7); //MOVETYPE_PUSH
entity_set_int(iEnt, EV_INT_solid, 0x4); // SOLID_BSP
entity_set_model(iEnt, g_sWut[BSP]);
new iRendered = create_entity("info_target");
entity_set_origin(iRendered, fOrigin);
entity_set_model(iRendered, g_sWut[MDL]);
}