HelpType cast?

Posts 14 of 4 · Page 1 of 1
Type cast?
Hey guys. I have a problem with the following lines of code:

tempx = statx - pPlayer->obj->origin.x;
tempy = staty - pPlayer->obj->origin.y;
tempz = statz - pPlayer->obj->origin.z;
CA crashes when the function containing these lines runs and I'm strongly suspecting the problem is here. The temp and stat variables are of type float and as you can see, I am trying to make a calculation based on some coords I already got and the current coords of whatever player the pointer currently holds (pPlayer is initialized from getplayerbyindex). So what am I doing wrong here? origin is a D3DVector type but aren't that type made up of float as well, should I really need to typecast anything here? Would be great if someone could help out and also explain what I'm doing wrong so I know to next time.
Im sure obj or pPlayer pointer is invalid!
Check for invalid pointers and update the class if needed!
Quote Originally Posted by Ch40zz-C0d3r View Post
Im sure obj or pPlayer pointer is invalid!
Check for invalid pointers and update the class if needed!
That seems unlikely, I'm using it for my telekill where it's working fine and also, there is a check that the pointer is valid before said code above runs so there must be another problem here hmm...
Quote Originally Posted by ctpsolo View Post
That seems unlikely, I'm using it for my telekill where it's working fine and also, there is a check that the pointer is valid before said code above runs so there must be another problem here hmm...
Post more of the code. I assume the error is on how you are using it.
Posts 14 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?