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

03-28-2014
, 15:36
make ent visible and solid only for owner
|
#1
|
Hi, we meet again.
I'm wondering if you could help me with some code examples.
I have the following test code.
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 ) { //code to make my ent visible and solid only for me. }
public think_NPC( iEnt ) { //Draw a box around it. 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 new Float: mins[3] = {-16.0, -16.0, -36.0 }; new 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; }
All i want is to make that 'test npc' visible and solid only for the owner stored in iuser1 ( in this case me )
__________________

My PC Themes . .
Last edited by red_bull2oo6; 03-28-2014 at 15:38.
Reason: forgot something.
|
|