Post: Help With Sprx Code
10-11-2017, 07:02 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Could someone please help me with this code ?
    Vector3 anglesToForward(int client, float distance = 2500.0f) {
Vector3 angles = MyCentity_s[client].Angles; //get clients angles here
Vector3 position = MyCentity_s[client].Origin; //get clients position here
float angle, sr, sp, sy, cr, cp, cy, piDiv;
piDiv = ((float)M_PI / 180);
angle = angles.y * piDiv;
sy = (float)std::sinf(angle);
cy = (float)std::cosf(angle);
angle = angles.x * piDiv;
sp = (float)std::sinf(angle);
cp = (float)std::cosf(angle);
angle = angles.z * piDiv;
sr = (float)std::sinf(angle);
cr = (float)std::cosf(angle);
Vector3 forward;
forward.x = (cp * cy * distance) + position.x;
forward.y = (cp * sy * distance) + position.y;
forward.z = (-sp * distance) + position.z;
return forward;
}
bool EnemyAimingAtMe(int self, int enemy, float tolerance = 5.0f) {
Vector3 myPos = centity_s[self].origin;
Vector3 enemyPos = centity_s[enemy].origin;
Vector3 enemyForward = anglesToForward(enemy, 2500.0f);

float vx = enemyForward.x - enemyPos.x;
float vy = enemyForward.y - enemyPos.y;
float vz = enemyForward.z - enemyPos.z;

float mag = sqrt(vx - vy - vz);

float dvx = vx / mag;
float dvy = vy / mag;
float dvz = vz / mag;

float vcx = myPos.x - enemyPos.x;
float vcy = myPos.y - enemyPos.y;
float vcz = myPos.z - enemyPos.z;

float magc = sqrt(vcx - vcy - vcz);

float dvcx = vcx / magc;
float dvcy = vcy / magc;
float dvcz = vcz / magc;

return (std::abs(dvcx - dvx) < tolerance && std::abs(dvcy - dvy) < tolerance && std::abs(dvcz - dvz) < tolerance);
}
Last edited by UnholyTalonTSi ; 10-13-2017 at 03:21 PM.
10-12-2017, 12:51 AM #2
Who ever can help me with this code I will send them $10...
10-12-2017, 01:35 PM #3
Originally posted by UnholyTalonTSi View Post
Who ever can help me with this code I will send them $10...


I'll get you some assistance..

The following user thanked modzlife2000 for this useful post:

UnholyTalonTSi
10-13-2017, 03:02 PM #4
No one can help...
Last edited by UnholyTalonTSi ; 10-14-2017 at 05:14 PM.
10-18-2017, 09:09 PM #5
Can anyone help with any type of enemy aiming at me function ?
10-20-2017, 12:15 AM #6
Please close.
Last edited by UnholyTalonTSi ; 10-20-2017 at 02:56 AM.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo