Camera Vectors in R5 - how to use, READ THIS!
#14

pawn Код:
stock GetPosFromView(playerid, Float:distance, &Float:x, &Float:y, &Float:z)
{
  new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
  GetPlayerCameraPos(playerid, cx, cy, cz);
  GetPlayerCameraFrontVector(playerid, fx, fy, fz);
  x = fx * distance + cx;
  y = fy * distance + cy;
  z = fz * distance + cz;
}
I couldn't think of other name..
This function returns coords of the point a player is looking at, depending on the distance.

Example:
pawn Код:
zcmd(bang,playerid,params[])
{
  new Float:r;
  if(sscanf(params,"f",r)) {}
  else
  {
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPosFromView(playerid, r, x, y, z);
    CreateExplosion(x, y, z, 2, 10);
  }
  return 1;
}
If you type /bang 20 there will be an explosion 20 gta units far from you.
Reply


Messages In This Thread
Camera Vectors in R5 - how to use, READ THIS! - by JernejL - 24.03.2010, 18:20
Re: Camera Vectors in R5 - how to use, READ THIS! - by Norn - 24.03.2010, 18:42
Re: Camera Vectors in R5 - how to use, READ THIS! - by JernejL - 24.03.2010, 18:44
Re: Camera Vectors in R5 - how to use, READ THIS! - by wafffllesss - 24.03.2010, 18:47
Re: Camera Vectors in R5 - how to use, READ THIS! - by Norn - 24.03.2010, 19:23
Re: Camera Vectors in R5 - how to use, READ THIS! - by JernejL - 24.03.2010, 21:13
Re: Camera Vectors in R5 - how to use, READ THIS! - by CracK - 25.03.2010, 05:15
Re: Camera Vectors in R5 - how to use, READ THIS! - by Burridge - 25.03.2010, 07:08
Re: Camera Vectors in R5 - how to use, READ THIS! - by boelie - 25.03.2010, 19:18
Re: Camera Vectors in R5 - how to use, READ THIS! - by JernejL - 25.03.2010, 19:30
Re: Camera Vectors in R5 - how to use, READ THIS! - by boelie - 25.03.2010, 19:37
Re: Camera Vectors in R5 - how to use, READ THIS! - by MaykoX - 25.03.2010, 19:59
Re: Camera Vectors in R5 - how to use, READ THIS! - by Rac3r - 26.03.2010, 07:22
Re: Camera Vectors in R5 - how to use, READ THIS! - by CracK - 26.03.2010, 11:22
Re: Camera Vectors in R5 - how to use, READ THIS! - by ev0lution - 27.03.2010, 01:36
Re: Camera Vectors in R5 - how to use, READ THIS! - by Norn - 27.03.2010, 08:11
Re: Camera Vectors in R5 - how to use, READ THIS! - by ev0lution - 28.03.2010, 08:35
Re: Camera Vectors in R5 - how to use, READ THIS! - by ev0lution - 02.04.2010, 00:15
Re: Camera Vectors in R5 - how to use, READ THIS! - by SourceCode - 20.09.2011, 01:34
Re: Camera Vectors in R5 - how to use, READ THIS! - by JernejL - 28.09.2011, 21:05
Re: Camera Vectors in R5 - how to use, READ THIS! - by SourceCode - 15.11.2011, 13:45
Re: Camera Vectors in R5 - how to use, READ THIS! - by Banditukas - 02.11.2014, 12:00

Forum Jump:


Users browsing this thread: 13 Guest(s)