Advertisement
Noneatme

Untitled

Oct 22nd, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. -- Bentzung: local objektid, weltposx, weltposy, weltposz, objektrotx, objektroty, objektrotz = getPlayerNearestBaum(thePlayer)
  2. local function getPlayerNearestBaum(thePlayer)
  3.     local x, y, z = getElementPosition(thePlayer)
  4.     for i = 1, 360, 1 do -- Wenn es laggt, die zweite 1 auf 5 setzen
  5.         local x2, y2 = getPointFromDistanceRotation(x, y, 2.5, i)
  6.         if(x2) and (y2) then
  7.             local hit, _, _, _, _, _, _, _, material, licht, _, objektid, wx, wy, wz, wrx, wry, wrz, objektlod = processLineOfSight(x, y, z, x2, y2, z, true, false, false, true, false, false, false, false, nil, true)
  8.             if(hit) and (objektid) then
  9.                 return objektid, wx, wy, wz, wrx, wry, wrz;
  10.             end
  11.         end
  12.     end
  13. end
  14.  
  15. function getPointFromDistanceRotation(x, y, dist, angle)
  16.  
  17.     local a = math.rad(90 - angle);
  18.  
  19.     local dx = math.cos(a) * dist;
  20.     local dy = math.sin(a) * dist;
  21.  
  22.     return x+dx, y+dy;
  23.  
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement