CapsAdmin

Untitled

Nov 24th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local print = epoe.Print
  2. local max = Vector(1,1,1) * 32768
  3.  
  4. local function HashToPos(pos)
  5.     pos = pos + max
  6.    
  7.     pos = pos * 2
  8.  
  9.     local x = math.floor(pos.x)
  10.     local y = math.floor(pos.y)
  11.     local z = math.floor(pos.z)
  12.        
  13.     return tonumber(string.format("0x%x%x%x", x, y, z))
  14. end
  15.  
  16. local function PosToHas(num)
  17.     local x = bit.band(num, 0xffff00000000) / 2
  18.     local y = bit.band(num, 0x0000ffff0000) / 2
  19.     local z = bit.band(num, 0x00000000ffff) / 2
  20.    
  21.     return Vector(x, y, z) - max
  22. end
  23.  
  24. local num = HashToPos(here)
  25. local vec = PosToHas(num)
  26. print(here)
  27. print(num)
  28. print(vec)
Advertisement
Add Comment
Please, Sign In to add comment