Raised This Month: $ Target: $400
 0% 

make ent visible and solid only for owner


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 03-28-2014 , 15:36   make ent visible and solid only for owner
Reply With Quote #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_iNPC33 ];
        
public 
plugin_precache( )    precache_modelg_szModel );
                
public 
plugin_init( )
{
    
    
register_pluginPLUGIN_NAMEPLUGIN_VERSION"Askhanar" );
    
register_clcmd"say /npc""ClCmdSayNPC" );
    
    
register_forwardFM_AddToFullPack"fw_AddToFullPackPre"false );
    
register_thinkg_szClassName"think_NPC" );
    
    
// Add your code here...
}

public 
client_putinserverid )    g_iNPCid ] = -99;
public 
client_disconnectid )
    if( 
g_iNPCid ] > )
        
remove_entityg_iNPCid ] );
        
public 
ClCmdSayNPCid )
{
    
g_iNPCid ] = CreateNPCid );
}

public 
fw_AddToFullPackes_handleeenthosthostflagsplayerpset )
{
    
//code to make my ent visible and solid only for me.
}

public 
think_NPCiEnt )
{
    
    
//Draw a box around it.
    
entity_set_floatiEntEV_FL_nextthinkget_gametime() + 1.7 );
    
    static 
Floatmins[3], Floatmaxs[3];
    
pev(iEntpev_absminmins);
    
pev(iEntpev_absmaxmaxs);

    
//Draw a box which is the size of the bounding NPC
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BOX);
    
engfunc(EngFunc_WriteCoordmins[0]);
    
engfunc(EngFunc_WriteCoordmins[1]);
    
engfunc(EngFunc_WriteCoordmins[2]);
    
engfunc(EngFunc_WriteCoordmaxs[0]);
    
engfunc(EngFunc_WriteCoordmaxs[1]);
    
engfunc(EngFunc_WriteCoordmaxs[2]);
    
write_short(100);
    
write_byte(random_num(25255));
    
write_byte(random_num(25255));
    
write_byte(random_num(25255));
    
message_end();
            
}


CreateNPC(idFloat:fOrigin]= { 0.00.00.0 }, Float:fAngle]= { 0.00.00.0 } )
{
    
    new 
iEnt  create_entity("info_target");
    
    
entity_set_stringiEntEV_SZ_classnameg_szClassName );
    
entity_get_vectoridEV_VEC_originfOrigin );
    
entity_set_originiEntfOrigin );
    
    
fOrigin] += 80;
    
entity_set_originidfOrigin );

    
entity_get_vectoridEV_VEC_anglesfAngle );
    
fAngle] = 0.0;
    
entity_set_vectoriEntEV_VEC_anglesfAngle );
    
    
    
entity_set_model(iEntg_szModel );
    
entity_set_int(iEntEV_INT_movetypeMOVETYPE_NONE );
    
    
entity_set_int(iEntEV_INT_solidSOLID_BBOX );
    
entity_set_int(iEntEV_INT_iuser1id );
    
    
//Create a bounding box for oru NPC
    
new Floatmins[3] = {-16.0, -16.0, -36.0 };
    new 
Floatmaxs[3] = { 16.016.036.0 };

    
entity_set_size(iEntminsmaxs);
    
entity_set_byteiEntEV_BYTE_controller1125 );
    
drop_to_floor(iEnt );
    
    
//set_rendering( iEnt, kRenderFxDistort, 0, 0, 0, kRenderTransAdd, 255 );
    
    //Make it instantly think
    
entity_set_floatiEntEV_FL_nextthinkget_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.
red_bull2oo6 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode