Raised This Month: $51 Target: $400
 12% 

make ent visible and solid only for owner


Post New Thread Reply   
 
Thread Tools Display Modes
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
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 05-13-2014 , 16:14   Re: make ent visible and solid only for owner
Reply With Quote #2

bump ?!
__________________

My PC Themes . .
red_bull2oo6 is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-13-2014 , 16:25   Re: make ent visible and solid only for owner
Reply With Quote #3

Try searching. I'll give you a little tip, you want to use ES_Solid and ES_RenderAmt.

There are literally hundreds of topics about AddToFullpack.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 05-13-2014 , 18:05   Re: make ent visible and solid only for owner
Reply With Quote #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_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 )
{
    
    if( !
player )
    {
        static 
szClassName32 ];
        
entity_get_stringentEV_SZ_classnameszClassNamesizeofszClassName ) -);
        
        if( 
equalszClassNameg_szClassName )
            && 
entity_get_intentEV_INT_iuser1 ) != host )
        {
            
            
set_eses_handleES_Origin, { 999999999.0999999999.0999999999.0 } );
            
set_eses_handleES_RenderModekRenderTransAlpha );
            
set_eses_handleES_RenderAmt);
            
            
set_eses_handleES_SolidSOLID_NOT );
        }
    }
    
}

public 
think_NPCiEnt )
{
    
    
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
    
static Floatmins[3] = {-16.0, -16.0, -36.0 };
    static 
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;


__________________

My PC Themes . .

Last edited by red_bull2oo6; 05-13-2014 at 18:07.
red_bull2oo6 is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 09-02-2015 , 12:02   Re: make ent visible and solid only for owner
Reply With Quote #5

bump ? anyone please just a scratch of code ?
__________________

My PC Themes . .
red_bull2oo6 is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 09-02-2015 , 14:08   Re: make ent visible and solid only for owner
Reply With Quote #6

pev_groupinfo

https://forums.alliedmods.net/showthread.php?t=205453
https://forums.alliedmods.net/showpo...3&postcount=14
https://forums.alliedmods.net/showthread.php?t=200238

Last edited by SpeeDeeR; 09-02-2015 at 14:09. Reason: link fix
SpeeDeeR is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 09-02-2015 , 14:20   Re: make ent visible and solid only for owner
Reply With Quote #7

i allready saw those links in other thread..about addtofullpack fwd in this section but i need for a specific player nor for a specific team.

why's my method not working ? what's wrong. i suck @addtofullpack
__________________

My PC Themes . .

Last edited by red_bull2oo6; 09-02-2015 at 14:20.
red_bull2oo6 is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 09-02-2015 , 20:50   Re: make ent visible and solid only for owner
Reply With Quote #8

You can't manipulate the solid state with this forward. What you really need is pev_groupinfo. The ent will be rendered just for it's owner.

PHP Code:
#define Mask(%0)    ( 1<<(%0 & 31) )

CreateNPC(...) {
    
//....
    //render it just for player with index id
    
set_peviEntpev_groupinfoMask(id));
    
    
//to make it visible for all players use 0 as third argument
    //to make it visible for additional player with index ID add him to the bitmask like
    //set_pev(iEnt, pev_groupinfo, pev(iEnt, pev_groupinfo ) | Mask( ID ) );
    //to remove him from the group use
    //set_pev(iEnt, pev_groupinfo, pev(iEnt, pev_groupinfo ) & ~Mask( ID ) )


Last edited by SpeeDeeR; 09-02-2015 at 20:52.
SpeeDeeR is offline
Reply



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 08:21.


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