Raised This Month: $ Target: $400
 0% 

entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alfre
Member
Join Date: Feb 2010
Old 06-11-2013 , 13:42   entity
Reply With Quote #1

PHP Code:
    new iEntity engfunc(EngFunc_FindEntityByStringiEntity"classname""spit_ent"
     
        new 
iPlayers32 ], iNum
        
get_playersiPlayersiNum"a""CT" ); 
     
        new 
Float:flClosestDist 150.0
        new 
iPlayerFloat:flDist
         new 
victim
        
for( new 0iNumi++ ) 
        { 
            
iPlayer iPlayers]; 
            
flDist entity_rangeiPlayeriEntity ); 
         
            if( 
flDist <= flClosestDist 
            { 
            
//code
           

      } 
if player is close to entity,my code will executed.but ent's are more than 1.how to do,that if player is close to entities?
__________________

alfre is offline
Send a message via Skype™ to alfre
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-11-2013 , 14:17   Re: entity
Reply With Quote #2

Try to find a more descriptive thread title.

PHP Code:
static ediedi 0;
while( 
pev_valid( ( edi engfuncEngFunc_FindEntityByStringedi"classname""my_classname" ) ) ) )
{
  
// do the code considering edi an edict (entity)

__________________

Last edited by claudiuhks; 06-11-2013 at 14:18.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
alfre
Member
Join Date: Feb 2010
Old 06-11-2013 , 15:11   Re: entity
Reply With Quote #3

PHP Code:
set_task(1.0,"test",0,_,_,"b")
public 
test()
{
static 
ediedi 0
while( 
pev_valid( ( edi engfuncEngFunc_FindEntityByStringedi"classname""spit_ent" ) ) ) ) 

    
client_print(0,print_chat,"TEST")
    }
}
doesn't work. 
__________________

alfre is offline
Send a message via Skype™ to alfre
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 06-11-2013 , 15:17   Re: entity
Reply With Quote #4

PHP Code:
static ediedi 0
new 
nearest 0;
new 
Float:distance 99999999.9999;
while( 
pev_valid( ( edi engfuncEngFunc_FindEntityByStringedi"classname""my_classname" ) ) ) ) 

  if(
entity_range(iPlayeredi) < distance)
  {
    
distance entity_range(iPlayeredi)
    
nearest edi;
  }
}  

client_print(0print_chat"nearest entity %i"nearest
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 06-11-2013 at 15:22.
joropito is offline
Send a message via MSN to joropito
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-11-2013 , 15:21   Re: entity
Reply With Quote #5

PHP Code:
static entFloat:o[3], Float:o2[3]
pevidpev_origino2[3] )
while( 
pev_valid( ( ent engfuncEngFunc_FindEntityByStringent"classname""spit_ent" ) ) ) )  
{  
    
peventpev_origin)
    if(
get_distance_f(oo2) >= 150.0)
    {
         
// your code here
    
}

I think that it is better to save entity index to variable ( with cellarray ) when you create your costom entity ( spit_ent ) and then just run a loop for your entities.
.Dare Devil. is offline
alfre
Member
Join Date: Feb 2010
Old 06-13-2013 , 06:57   Re: entity
Reply With Quote #6

thanks guys... but this helped me
PHP Code:
register_touch("spit_ent""player""FwdPlayerTouchTriggerOnce"); 
__________________


Last edited by alfre; 06-13-2013 at 06:57.
alfre is offline
Send a message via Skype™ to alfre
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 05:59.


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