|
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
|

05-13-2014
, 18:05
Re: make ent visible and solid only for owner
|
#4
|
i did, and i tried some 'methods' by myself but i didn't figured it out.
here is one of them i found.
it makes it invisible but it's still solid.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx > #include < fakemeta > #include < engine >
#pragma semicolon 1
new const PLUGIN_NAME[ ] = "New Plugin", PLUGIN_VERSION[ ] = "1.0";
new const g_szModel[ ] = "models/player/sas/sas.mdl"; new const g_szClassName[ ] = "CustomNPC";
new g_iNPC[ 33 ];
public plugin_precache( ) precache_model( g_szModel );
public plugin_init( ) { register_plugin( PLUGIN_NAME, PLUGIN_VERSION, "Askhanar" ); register_clcmd( "say /npc", "ClCmdSayNPC" ); register_forward( FM_AddToFullPack, "fw_AddToFullPackPre", false ); register_think( g_szClassName, "think_NPC" ); // Add your code here... }
public client_putinserver( id ) g_iNPC[ id ] = -99; public client_disconnect( id ) if( g_iNPC[ id ] > 0 ) remove_entity( g_iNPC[ id ] );
public ClCmdSayNPC( id ) { g_iNPC[ id ] = CreateNPC( id ); }
public fw_AddToFullPack( es_handle, e, ent, host, hostflags, player, pset ) { if( !player ) { static szClassName[ 32 ]; entity_get_string( ent, EV_SZ_classname, szClassName, sizeof( szClassName ) -1 ); if( equal( szClassName, g_szClassName ) && entity_get_int( ent, EV_INT_iuser1 ) != host ) { set_es( es_handle, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } ); set_es( es_handle, ES_RenderMode, kRenderTransAlpha ); set_es( es_handle, ES_RenderAmt, 0 ); set_es( es_handle, ES_Solid, SOLID_NOT ); } } }
public think_NPC( iEnt ) { entity_set_float( iEnt, EV_FL_nextthink, get_gametime() + 1.7 ); static Float: mins[3], Float: maxs[3]; pev(iEnt, pev_absmin, mins); pev(iEnt, pev_absmax, maxs); //Draw a box which is the size of the bounding NPC message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BOX); engfunc(EngFunc_WriteCoord, mins[0]); engfunc(EngFunc_WriteCoord, mins[1]); engfunc(EngFunc_WriteCoord, mins[2]); engfunc(EngFunc_WriteCoord, maxs[0]); engfunc(EngFunc_WriteCoord, maxs[1]); engfunc(EngFunc_WriteCoord, maxs[2]); write_short(100); write_byte(random_num(25, 255)); write_byte(random_num(25, 255)); write_byte(random_num(25, 255)); message_end(); }
CreateNPC(id, Float:fOrigin[ 3 ]= { 0.0, 0.0, 0.0 }, Float:fAngle[ 3 ]= { 0.0, 0.0, 0.0 } ) {
new iEnt = create_entity("info_target"); entity_set_string( iEnt, EV_SZ_classname, g_szClassName ); entity_get_vector( id, EV_VEC_origin, fOrigin ); entity_set_origin( iEnt, fOrigin ); fOrigin[ 2 ] += 80; entity_set_origin( id, fOrigin ); entity_get_vector( id, EV_VEC_angles, fAngle ); fAngle[ 0 ] = 0.0; entity_set_vector( iEnt, EV_VEC_angles, fAngle ); entity_set_model(iEnt, g_szModel ); entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_NONE ); entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int(iEnt, EV_INT_iuser1, id ); //Create a bounding box for oru NPC static Float: mins[3] = {-16.0, -16.0, -36.0 }; static Float: maxs[3] = { 16.0, 16.0, 36.0 }; entity_set_size(iEnt, mins, maxs); entity_set_byte( iEnt, EV_BYTE_controller1, 125 ); drop_to_floor(iEnt ); //set_rendering( iEnt, kRenderFxDistort, 0, 0, 0, kRenderTransAdd, 255 ); //Make it instantly think entity_set_float( iEnt, EV_FL_nextthink, get_gametime() + 0.01 ); return iEnt;
}
__________________

My PC Themes . .
Last edited by red_bull2oo6; 05-13-2014 at 18:07.
|
|