Raised This Month: $ Target: $400
 0% 

Entity moving in front of player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-23-2021 , 05:06   Re: Entity moving in front of player
Reply With Quote #3

Here this should be more reliable !

PHP Code:
stock shift_entity_position(entFloat:forwFloat:rightFloat:up)
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vEnd[3];
    
    
pev(entpev_originvOrigin);
    
pev(entpev_anglesvAngle);
    
    
angle_vector(vAngle,ANGLEVECTOR_FORWARDvForward); //or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHTvRight);
    
    
vEnd[0] = vOrigin[0] + (vForward[0] * forw) + (vRight[0] * right);
    
vEnd[1] = vOrigin[1] + (vForward[1] * forw) + (vRight[1] * right);
    
vEnd[2] = vOrigin[2] + up;

    static 
iTr2iTr2 create_tr2();
    
engfunc(EngFunc_TraceLinevOriginvEndDONT_IGNORE_MONSTERSentiTr2);
    
get_tr2(iTr2TR_vecEndPosvEnd);
    
free_tr2(iTr2);

    
set_pev(entpev_originvEnd);
}

public 
Item_think(ent)
{
    static 
ownerFloat:fStartPos[3], Float:fvOFS[3], Float:fAngles[3];
    
owner pev(entpev_owner);
    
    
// How to use ?
    
pev(ownerpev_originfStartPos);
    
pev(ownerpev_view_ofsfvOFS);
    
pev(ownerpev_v_anglefAngles);
    
Float:fAngles[0] = 0.0;
    
fStartPos[2] += fvOFS[2];
    
set_pev(entpev_originfStartPos);
    
set_pev(entpev_anglesfAngles);
    
shift_entity_position(ent100.00.00.0); //100.0 just for testing, might be smaller

    
set_pev(entpev_nextthinkget_gametime()+0.1);

can you confirm this works?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-23-2021 at 10:15.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
 


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 07:44.


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