AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help my with fm_find_ent? [class and in radius] (https://forums.alliedmods.net/showthread.php?t=155985)

Nightfall1 04-29-2011 07:26

help my with fm_find_ent? [class and in radius]
 
PHP Code:

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_find_ent_in_sphere(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)
 
 
public thisIsPublic(id)
{
    
// Get origin
    
static Float:originF[3]
    
pev(idpev_originoriginF)
 
    new 
ent
    ent 
= -1
    
if((ent fm_find_ent_by_class(ent"func_breakable") | fm_find_ent_in_sphere(entoriginF150.0)) != 0)
    {
        
client_print(0print_center"HIT:%d"ent//- dev only
    
}


client_print worck but is not work for corect entity
the point is i need to find a class and find is in range
I also tried
PHP Code:

stock Float:fm_entity_range(ent1ent2) { 
 new 
Float:origin1[3], Float:origin2[3
 
pev(ent1pev_originorigin1
 
pev(ent2pev_originorigin2
 
 return 
get_distance_f(origin1origin2



SonicSonedit 04-29-2011 07:56

Re: help my with fm_find_ent? [class and in radius]
 
PHP Code:

public thisIsPublic(id)
{
    static 
entFloat:originF[3], classname[32]

    
pev(idpev_originoriginF)
    
ent=fm_find_ent_in_sphere(entoriginF150.0)
    
    while (
pev_valid(ent))
    {
        
pev(entpev_classnameclassnamecharsmax(classname))
        
client_print(0print_chat"[DEBUG] find entity %d: %s"entclassname//- dev only
        
        
if (equal(classname"func_breakable"))
        {
            
client_print(0print_chat"found breakable!")
            
// do your code here
        
}
        
        
ent=fm_find_ent_in_sphere(entoriginF150.0)
    }



Arkshine 04-29-2011 07:59

Re: help my with fm_find_ent? [class and in radius]
 
http://www.amxmodx.org/funcwiki.php?go=func&id=390

SonicSonedit 04-29-2011 08:05

Re: help my with fm_find_ent? [class and in radius]
 
Arkshine

Arkshine 04-29-2011 08:06

Re: help my with fm_find_ent? [class and in radius]
 
And ?

SonicSonedit 04-29-2011 08:11

Re: help my with fm_find_ent? [class and in radius]
 
And he uses fm.

Arkshine 04-29-2011 08:23

Re: help my with fm_find_ent? [class and in radius]
 
Just because he tries something with fakemeta doesn't mean you can't advice him to use the appropriate native. Module has nothing to do here. find_sphere_class should be used.

SonicSonedit 04-29-2011 08:26

Re: help my with fm_find_ent? [class and in radius]
 
Arkshine
Don't you agree that it's better to use 1 module than 2 modules that do almost the same thing?

Arkshine 04-29-2011 08:48

Re: help my with fm_find_ent? [class and in radius]
 
Module has nothing to here. Just use intelligently the provided natives considering your needs whatever the modules. The less natives you call, the faster your plugin will be. There is a tutorial about that by the way.

Nightfall1 04-29-2011 08:53

Re: help my with fm_find_ent? [class and in radius]
 
Quote:

Originally Posted by SonicSonedit (Post 1460044)
Arkshine
Don't you agree that it's better to use 1 module than 2 modules that do almost the same thing?

totally agree with you
I don't care how faster is engine, or my plugin (maybe if the delay more 5000 ms)
Thanks for support my


All times are GMT -4. The time now is 04:27.

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