Raised This Month: $ Target: $400
 0% 

[HELP] find_sphere_class On Bots


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 17:22.


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