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

This or This


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XSlayer
Member
Join Date: Dec 2021
Old 07-28-2022 , 17:03   This or This
Reply With Quote #1

Hi, in terms of memory, whis is better to use?

This
PHP Code:
velocity_by_aim(iIndexiVelocityFloat:vRetValue[3]); 
>

PHP Code:
static cell AMX_NATIVE_CALL VelocityByAim(AMX *amxcell *params)
{
    
int iEnt params[1];
    
int iVelocity params[2];
    
cell *vRet get_amxaddr(amxparams[3]);
    
Vector vVector Vector(000);
    
edict_t *pEnt NULL;
 
    if (
iEnt || iEnt gpGlobals->maxEntities)
    {
        
LogError(amxAMX_ERR_NATIVE"Entity out of range (%d)"iEnt);
        return 
0;
    }
    else
    {
        if (
iEnt && iEnt <= gpGlobals->maxClients)
        {
            if (!
GET_PLAYER_POINTER_I(iEnt)->ingame)
            {
                
LogError(amxAMX_ERR_NATIVE"Invalid player %d (not ingame)"iEnt);
                return 
0;
            }
            
pEnt GET_PLAYER_POINTER_I(iEnt)->pEdict;
        } else {
            
pEnt INDEXENT(iEnt);
        }
    }
 
    if (!
pEnt)
    {
        
LogError(amxAMX_ERR_NATIVE"Invalid entity %d (nullent)"iEnt);
        return 
0;
    }
 
    
MAKE_VECTORS(pEnt->v.v_angle);
    
vVector gpGlobals->v_forward iVelocity;
 
    
vRet[0] = FloatToCell(vVector.x);
    
vRet[1] = FloatToCell(vVector.y);
    
vRet[2] = FloatToCell(vVector.z);
 
    return 
1;

Or This:

PHP Code:
stock setAIMVelocityClientFloat:__fl_SpeedFloat:__fl_Velocity[3] )
{
    static 
Float:__fl_v_Angles[3];
    
entity_get_vectorClientEV_VEC_v_angle__fl_v_Angles );

    
engfuncEngFunc_MakeVectors__fl_v_Angles );
    
get_global_vector(GL_v_forward__fl_v_Angles);

    
__fl_Velocity[0] = __fl_v_Angles[0] * __fl_Speed;
    
__fl_Velocity[1] = __fl_v_Angles[1] * __fl_Speed;
    
__fl_Velocity[2] = __fl_v_Angles[2] * __fl_Speed;


Last edited by XSlayer; 07-28-2022 at 17:20.
XSlayer is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-28-2022 , 18:06   Re: This or This
Reply With Quote #2

I always use the native version, unless I need to modify the functionality in any way.
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 04:06.


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