Post: Bullet Trace / Teleport Gun
05-28-2016, 06:44 AM #1
matrixmods
Pokemon Trainer
(adsbygoogle = window.adsbygoogle || []).push({}); So here is my current code:
    

typedef struct trace_t
{
float fraction;
byte Buffer[0x28];
};

void LocationalTrace(trace_t* trace, float* start, float* end)
{
void(*G_LocationalTrace)(trace_t* Trace, float* Start, float* End, int u1, int u2, int u3) = (void(*)(trace_t*, float*, float*, int, int, int))&G_LocationalTrace_t;
G_LocationalTrace(trace, start, end, 0, 0x28060B1, 0);
}

float* G_GetPlayerViewOrigin(int G_Client) {
float Org[3];
void(*GPVO)(int gClient, float* Org) = (void(*)(int, float*))&GetPlayerViewOrigin_t;
GPVO(G_Client, Org);
return Org;
}

float* BulletTrace(unsigned int ClientID){
trace_t trace;
float* Start = G_GetPlayerViewOrigin(ClientID);
float* Angles = ReadFloat(getClient(ClientID, 0x10C),3);
float* End = AnglesToForward(Angles,Start,999999);
LocationalTrace(&trace, Start, End);
float Pos[3];
for(unsigned char i = 0; i < 3; i++) Pos[i] = (((End[i]-Start[i]) * trace.fraction) + Start[i]);
return Pos;
}


I am not really sure what happens. So for teleport gun what i would do is SetLocation(client, BulletTrace(client)); and that would (assuming SetLocation is correct) move me to the position my bullet shoots at. However when i do this it just teleports me to the same location no matter where i am aiming.
Last edited by matrixmods ; 05-29-2016 at 06:27 PM. Reason: updated code
05-29-2016, 09:02 PM #2
matrixmods
Pokemon Trainer
anyone?
08-04-2016, 06:42 PM #3
Originally posted by matrixmods View Post
So here is my current code:
    

typedef struct trace_t
{
float fraction;
byte Buffer[0x28];
};

void LocationalTrace(trace_t* trace, float* start, float* end)
{
void(*G_LocationalTrace)(trace_t* Trace, float* Start, float* End, int u1, int u2, int u3) = (void(*)(trace_t*, float*, float*, int, int, int))&G_LocationalTrace_t;
G_LocationalTrace(trace, start, end, 0, 0x28060B1, 0);
}

float* G_GetPlayerViewOrigin(int G_Client) {
float Org[3];
void(*GPVO)(int gClient, float* Org) = (void(*)(int, float*))&GetPlayerViewOrigin_t;
GPVO(G_Client, Org);
return Org;
}

float* BulletTrace(unsigned int ClientID){
trace_t trace;
float* Start = G_GetPlayerViewOrigin(ClientID);
float* Angles = ReadFloat(getClient(ClientID, 0x10C),3);
float* End = AnglesToForward(Angles,Start,999999);
LocationalTrace(&trace, Start, End);
float Pos[3];
for(unsigned char i = 0; i < 3; i++) Pos[i] = (((End[i]-Start[i]) * trace.fraction) + Start[i]);
return Pos;
}


I am not really sure what happens. So for teleport gun what i would do is SetLocation(client, BulletTrace(client)); and that would (assuming SetLocation is correct) move me to the position my bullet shoots at. However when i do this it just teleports me to the same location no matter where i am aiming.

and i just Keep getting an internal stack overflow
12-05-2016, 11:31 PM #4
Originally posted by matrixmods View Post
So here is my current code:
    

typedef struct trace_t
{
float fraction;
byte Buffer[0x28];
};

void LocationalTrace(trace_t* trace, float* start, float* end)
{
void(*G_LocationalTrace)(trace_t* Trace, float* Start, float* End, int u1, int u2, int u3) = (void(*)(trace_t*, float*, float*, int, int, int))&G_LocationalTrace_t;
G_LocationalTrace(trace, start, end, 0, 0x28060B1, 0);
}

float* G_GetPlayerViewOrigin(int G_Client) {
float Org[3];
void(*GPVO)(int gClient, float* Org) = (void(*)(int, float*))&GetPlayerViewOrigin_t;
GPVO(G_Client, Org);
return Org;
}

float* BulletTrace(unsigned int ClientID){
trace_t trace;
float* Start = G_GetPlayerViewOrigin(ClientID);
float* Angles = ReadFloat(getClient(ClientID, 0x10C),3);
float* End = AnglesToForward(Angles,Start,999999);
LocationalTrace(&trace, Start, End);
float Pos[3];
for(unsigned char i = 0; i < 3; i++) Pos[i] = (((End[i]-Start[i]) * trace.fraction) + Start[i]);
return Pos;
}


I am not really sure what happens. So for teleport gun what i would do is SetLocation(client, BulletTrace(client)); and that would (assuming SetLocation is correct) move me to the position my bullet shoots at. However when i do this it just teleports me to the same location no matter where i am aiming.


you're doing the floats wrong.
12-06-2016, 03:21 PM #5
S63
Space Ninja
Originally posted by oStankyModz View Post
you're doing the floats wrong.


I think he's already fixed it Smile
12-06-2016, 07:32 PM #6
Originally posted by S63 View Post
I think he's already fixed it Smile

Thread should be closed then.
12-06-2016, 08:01 PM #7
matrixmods
Pokemon Trainer
Originally posted by oStankyModz View Post
Thread should be closed then.


Yea I fixed this a long time ago lol
12-06-2016, 08:59 PM #8
Originally posted by matrixmods View Post
Yea I fixed this a long time ago lol


Matrix you got skype? Need some help with something.. My skype is: "wonktwists" add me if you dont mind.
01-21-2017, 03:47 PM #9
Originally posted by oStankyModz View Post
you're doing the floats wrong.

Which float* were wrong ? im having the same problem
02-01-2017, 12:48 AM #10
Luckeyy
Retired - Lead Content Manager
Issue Solved.

Closed.

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo