Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. function attachArmor()
  2.     local player = getLocalPlayer()
  3.     local px, py, pz = getElementPosition(player)
  4.     local vx, vy, vz = getPedBonePosition(player,3)
  5.     local sx = px - vx
  6.     local sy = py - vy
  7.     local sz = pz - vz
  8.     local rotpX = 0
  9.     local rotpY = 0
  10.     local rotpZ = getPedRotation(player)
  11.     local rotvX,rotvY,rotvZ = getElementRotation(player)
  12.     local t = math.rad(rotvX)
  13.     local p = math.rad(rotvY)
  14.     local f = math.rad(rotvZ)
  15.     local ct = math.cos(t)
  16.     local st = math.sin(t)
  17.     local cp = math.cos(p)
  18.     local sp = math.sin(p)
  19.     local cf = math.cos(f)
  20.     local sf = math.sin(f)
  21.     local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy
  22.     local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy
  23.     local y = st*sz - sf*ct*sx + cf*ct*sy
  24.     local rotX = rotpX - rotvX
  25.     local rotY = rotpY - rotvY
  26.     local rotZ = rotpZ - rotvZ
  27.     local object = createObject(1242, 0,0,-15 )
  28.     setObjectScale(object,1.5)
  29.     exports.COG_bone_attach:attachElementToBone(object,player,3,x, y, z , rotX, rotY, rotZ)
  30. end
  31. addCommandHandler("armor",attachArmor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement