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

Convert Engine to Pawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 09-04-2011 , 09:32   Convert Engine to Pawn
Reply With Quote #1

I'm having the utmost trouble in converting this small piece of engine code to pawn for CS 1.6 that I found when Arkshine posted it.

It's how the engine detects backstabbing from the knife.

Any help on this would be great as I have no knowledge of how to work with C++. (I presume its C++)

PHP Code:
float damage 65.0;

if ( 
pEntity && pEntity->IsPlayer() )
{
    
Vector2D vec2LOS;
    
Vector   vecForward gpGlobals->v_forward;

    
UTIL_MakeVectorsm_pPlayer->pev->angles );

    
vec2LOS vecForward.Make2D();
    
vec2LOS vec2LOS.Normalize();

    if ( 
DotProductvec2LOSgpGlobals->v_forward.Make2D() ) > 0.8 )
    {
        
damage *= 3.0;
    }

__________________
It's a mystery.
Mini_Midget is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-04-2011 , 10:51   Re: Convert Engine to Pawn
Reply With Quote #2

Can you explain a bit more, about its function ?
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 09-04-2011 , 10:54   Re: Convert Engine to Pawn
Reply With Quote #3

It detects whether a knife stab was in the back of the enemy, and if it is, the damage is multiplied by 3.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
bibu
Veteran Member
Join Date: Sep 2010
Old 09-04-2011 , 10:54   Re: Convert Engine to Pawn
Reply With Quote #4

Quote:
Originally Posted by Mini_Midget View Post
detects backstabbing from the knife.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-04-2011 , 10:59   Re: Convert Engine to Pawn
Reply With Quote #5

You could theoretically check on Ham_TraceAttack hitbox, if it wasn't arm or leg or something, it could be a backstab.

Then check if the victim can see attacker, that possibly could do the trick, but it may not be completely accurate.

There for sure is a better way using xs and things like that, but I'm unfamiliar with them so this is the only advice I can give you.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-04-2011 , 12:12   Re: Convert Engine to Pawn
Reply With Quote #6

Seems like there is something missing in the code, pEntity should be used somewhere in that block.

To convert, you could try to set pEntity pev_fov to 0.8, send is_in_viewcone and reset pev_fov but i'm not sure it would work.
If you use orpheu, then it should work, same tip but using offset m_flFieldOfView and function CBaseMonster::FInViewCone.
If you really want to convert, then have a look at fm_is_in_viewcone stock in fakemeta_util.inc
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-04-2011 at 12:15.
ConnorMcLeod 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 11:04.


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