Advertisement
JUNIORCEDE1

Untitled

Mar 27th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1.  
  2. sH, sW = guiGetScreenSize()
  3. x_prev = nil
  4.  
  5. function setPrevX()
  6.     x, _ = getCursorPosition ()
  7.     x_prev = x*sW
  8. end
  9.  
  10.  
  11. function girarpj()
  12.     if getKeyState ("mouse2") then
  13.         x, _ = getCursorPosition ()
  14.         x=x*sW
  15.         change_rot = (x-x_prev)
  16.         local _, _, ped_rot = getElementRotation ( Jugador )
  17.         local rot_to = ped_rot+change_rot
  18.         if rot_to < 0 then
  19.             rot_to = ped_rot+change_rot+360
  20.         end
  21.         setElementRotation ( Jugador, 0, 0, rot_to )
  22.         x_prev = x
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement