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

[HELP] find_sphere_class On Bots


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellmonja
Senior Member
Join Date: Oct 2015
Old 08-03-2019 , 15:01   [HELP] find_sphere_class On Bots
Reply With Quote #1

So I'm using find_sphere_class to find players around a certain area but it only works when I'm near said area. When only the bots are there nothing happens. First my question is does find_sphere_class work on bots? And if it doesn't, how do I include the bots?...
__________________

Last edited by hellmonja; 08-03-2019 at 15:03.
hellmonja is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 08-03-2019 , 15:05   Re: [HELP] find_sphere_class On Bots
Reply With Quote #2

I'm sorry. Somehow it works now. I'm not sure what happened the first few times I tried it. You can close the thread now. Sorry again for the bother...
__________________
hellmonja is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-03-2019 , 15:49   Re: [HELP] find_sphere_class On Bots
Reply With Quote #3

It doesn't skip bots.
PHP Code:
static cell AMX_NATIVE_CALL find_sphere_class(AMX *amxcell *params// find_sphere_class(aroundent, _lookforclassname[], Float:radius, entlist[], maxents, Float:origin[3] = {0.0, 0.0, 0.0}); // 6 params
{
    
// params[1] = index to find around, if this is less than 1 then use around origin in last parameter.
    // params[2] = classname to find
    
int len;
    
charclassToFind MF_GetAmxString(amxparams[2], 0, &len);
    
// params[3] = radius, float...
    
REAL radius =amx_ctof(params[3]);
    
// params[4] = store ents in this list
    
cell *entList MF_GetAmxAddr(amxparams[4]);
    
// params[5] = maximum ents to store in entlist[] in params[4]
    // params[6] = origin, use this if params[1] is less than 1

    
vec3_t vecOrigin;
    if (
params[1] > 0) {
        
CHECK_ENTITY(params[1]);

        
edict_tpEntity TypeConversion.id_to_edict(params[1]);
        
vecOrigin pEntity->v.origin;
    } else {
        
cell *cAddr MF_GetAmxAddr(amxparams[6]);
        
vecOrigin Vector(amx_ctof(cAddr[0]), amx_ctof(cAddr[1]), amx_ctof(cAddr[2]));
    }
    
    
int entsFound 0;
    
edict_tpSearchEnt TypeConversion.id_to_edict(0);

    while (
entsFound params[5]) {
        
pSearchEnt FIND_ENTITY_IN_SPHERE(pSearchEntvecOriginradius); // takes const float origin
        
if (FNullEnt(pSearchEnt))
            break;
        else {
            if (
strcmp(STRING(pSearchEnt->v.classname), classToFind) == 0) {
                
// Add to entlist (params[4])
                
entList[entsFound++] = TypeConversion.edict_to_id(pSearchEnt); // raise entsFound
            
}
        }
    }

    return 
entsFound;

__________________
edon1337 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 16:52.


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