Advertisement
davedumas0

Untitled

Jan 2nd, 2018
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.04 KB | None | 0 0
  1. Citizen.CreateThread(function()
  2.   while true do
  3.     if IsControlPressed(0, 21) and IsControlJustPressed(1, 168) then
  4.      showInfo = not showInfo
  5.    end  
  6.      Citizen.Wait(0)
  7.      playerPed = GetPlayerPed(PlayerId())
  8.      playerCoords = GetEntityCoords(GetPlayerPed(PlayerId()), true)
  9.      playerCoordsX = playerCoords.x
  10.      playerCoordsY = playerCoords.y
  11.      playerCoordsZ = playerCoords.z
  12.      playerHeading = GetEntityHeading(GetPlayerPed(PlayerId()))
  13.      PlayerRoomKey = GetRoomKeyFromEntity(GetPlayerPed(PlayerId()))
  14.      playerInteriorID = GetInteriorFromEntity(GetPlayerPed(PlayerId()))
  15.      entityRoomKey = GetRoomKeyFromEntity(a)
  16.      entityInteriorID = GetInteriorFromEntity(a)
  17.      entityCoords = GetEntityCoords(closestEntity, true)
  18.      interiorGroupID = GetInteriorGroupId(entityInteriorID)
  19.      ForceRoomForEntity(a, playerInteriorID, PlayerRoomKey)
  20.      EntityInterior = GetInteriorFromEntity(a)
  21.      EntityRoomKey = GetRoomKeyFromEntity(a)
  22.     if showInfo then
  23.       --SetNetworkIdExistsOnAllMachines(dude10, true)
  24.       --NetworkRegisterEntityAsNetworked(dude10)
  25.       --NetworkSetEntityVisibleToNetwork(dude10, true)
  26.       requestControl = NetworkRequestControlOfEntity(dude10)
  27.     local entityCoords = GetEntityCoords(dude10)
  28.     local entityRot = GetEntityRotation(dude10, 2)
  29.     local playerRot = GetEntityRotation(GetPlayerPed(), 2)
  30.     local playerCoords = GetEntityCoords(GetPlayerPed())
  31.     local isEntityNetworked = NetworkHasControlOfEntity(dude10)
  32.      entityNetworkID = NetworkGetNetworkIdFromEntity(dude10)
  33.      doesEntityExist = NetworkDoesNetworkIdExist(NetworkGetNetworkIdFromEntity(dude10))
  34.       SetEntityAsMissionEntity(dude10, 1, 0)
  35.      DrawSprite("shared","bggradient", 0.85, 0.39, 0.28, 0.60, 90.0, 0, 0, 0, 200)
  36.      drawTxt('DEBUG INFO ', 6, 1, 0.88, 0.097 , 0.5, 255, 0, 0, 255)
  37.      drawTxt('entity ID: ', 6, 1, 0.80, 0.125 , 0.6, 255, 255, 255, 255)
  38.      drawTxt(tostring(dude10), 6, 1, 0.91, 0.125 , 0.6, 0, 255, 255, 255)
  39.      drawTxt('entity model hash: ', 6, 1, 0.80, 0.150 , 0.6, 255, 255, 255, 255)
  40.      drawTxt(tostring(GetEntityModel(dude10)), 6, 1, 0.91, 0.150 , 0.6, 0, 255, 255, 255)
  41.      drawTxt('entity interior: ', 6, 1, 0.80, 0.177, 0.6, 255, 255, 255, 255)
  42.      drawTxt(tostring(GetInteriorFromEntity(dude10)) , 6, 1, 0.91, 0.177, 0.6, 0, 255, 255, 255)
  43.      drawTxt('networkID: ', 6, 1, 0.80, 0.200, 0.6, 255, 255, 255, 255)
  44.      drawTxt(tostring(NetworkGetNetworkIdFromEntity(dude10)) , 6, 1, 0.91, 0.200, 0.6, 0, 255, 255, 255)
  45.      drawTxt('is entity networked: ', 6, 1, 0.81, 0.230, 0.6, 255, 255, 255, 255)
  46.      drawTxt(tostring(isEntityNetworked) , 6, 1, 0.91, 0.230, 0.6, 0, 255, 255, 255)
  47.      drawTxt('requestControl', 6, 1, 0.81, 0.260, 0.6, 255, 255, 255, 255)
  48.      drawTxt(tostring(requestControl) , 6, 1, 0.91, 0.260, 0.6, 0, 255, 255, 255)
  49.      drawTxt('doesEntityExist', 6, 1, 0.81, 0.290, 0.6, 255, 255, 255, 255)
  50.      drawTxt(tostring(doesEntityExist) , 6, 1, 0.91, 0.290, 0.6, 0, 255, 255, 255)
  51.      drawTxt('entity X coords: ', 6, 1, 0.80, 0.320, 0.6 , 0, 255, 0, 255)
  52.      drawTxt(tostring(entityCoords.x) , 6, 1, 0.91, 0.320, 0.6, 0, 255, 0, 255)
  53.      drawTxt("entity Y coords: ", 6, 1, 0.80, 0.350, 0.6, 0, 255, 0, 255)
  54.      drawTxt(tostring(entityCoords.y) , 6, 1, 0.91, 0.350, 0.6, 0, 255, 0, 255)
  55.      drawTxt("entity Z coords: ", 6, 1, 0.80, 0.380, 0.6, 0, 255, 0, 255)
  56.      drawTxt(tostring(entityCoords.z) , 6, 1, 0.91, 0.380, 0.6, 0, 255, 0, 255)
  57.      drawTxt('entity X rotation: ', 6, 1, 0.80, 0.410, 0.6, 0, 255, 0, 255)
  58.      drawTxt(tostring(entityRot.x) , 6, 1, 0.91, 0.410, 0.6, 0, 255, 0, 255)
  59.      drawTxt('entity Y rotation: ', 6, 1, 0.80, 0.440, 0.6, 0, 255, 0, 255)
  60.      drawTxt(tostring(entityRot.y) , 6, 1, 0.91, 0.440, 0.6, 0, 255, 0, 255)
  61.      drawTxt('entity Z rotation: ', 6, 1, 0.80, 0.470, 0.6, 0, 255, 0, 255)
  62.      drawTxt(tostring(entityRot.z) , 6, 1, 0.91, 0.470, 0.6, 0, 255, 0, 255)
  63.      drawTxt('Player X rotation: ', 6, 1, 0.80, 0.500, 0.6, 255, 255, 255, 255)
  64.      drawTxt(tostring(playerRot.x) , 6, 1, 0.91, 0.500, 0.6, 0, 0, 255, 255)
  65.      drawTxt('Player Y rotation: ', 6, 1, 0.80, 0.530, 0.6, 255, 255, 255, 255)
  66.      drawTxt(tostring(playerRot.y) , 6, 1, 0.91, 0.530, 0.6, 0, 0, 255, 255)
  67.      drawTxt('Player Z rotation: ', 6, 1, 0.80, 0.560, 0.6, 255, 255, 255, 255)
  68.      drawTxt(tostring(playerRot.z) , 6, 1, 0.91, 0.560, 0.6, 0, 0, 255, 255)
  69.      drawTxt('Player X position: ', 6, 1, 0.80, 0.590, 0.6, 255, 255, 255, 255)
  70.      drawTxt(tostring(playerCoords.x) , 6, 1, 0.91, 0.590, 0.6, 0, 255, 0, 255)
  71.      drawTxt('Player Y position: ', 6, 1, 0.80, 0.620, 0.6, 255, 255, 255, 255)
  72.      drawTxt(tostring(playerCoords.y) , 6, 1, 0.91, 0.620, 0.6, 0, 255, 0, 255)
  73.      drawTxt('Player Z position: ', 6, 1, 0.80, 0.650, 0.6, 255, 255, 255, 255)
  74.      drawTxt(tostring(playerCoords.z) , 6, 1, 0.91, 0.650, 0.6, 0, 255, 0, 255)
  75.      drawTxt('Player Heading: ', 6, 1, 0.80, 0.690, 0.6, 255, 255, 255, 255)
  76.      drawTxt(tostring(GetEntityHeading(GetPlayerPed())) , 6, 1, 0.91, 0.690, 0.6, 0, 255, 0, 255)
  77.      
  78.     end
  79. -----------------------------------------------------------------------------------------------------------------------------------------------------
  80. ---------------------------------this checks if the spawned entity exists and moves it as player pushes buttons---------------------------------------
  81. -----------------------------------------------------------------------------------------------------------------------------------------------------
  82.     if not DoesEntityExist(a) or DoesEntityExist(GetClosestObjectOfType(playerCoordsX, playerCoordsY, playerCoordsZ, 50.0, stuff, 0, 1, 0))  then
  83.      a = GetClosestObjectOfType(playerCoordsX, playerCoordsY, playerCoordsZ, 50.0, stuff, 0, 1, 0)
  84.     end
  85.     if DoesEntityExist(a) then
  86.      b = ObjToNet(a)     
  87. --this gets the entity coords
  88.         entityCoords = GetEntityCoords(a)
  89.         entityCoords1 = GetEntityCoords(b)     
  90. --this splits up the coords
  91.           entityX = entityCoords.x
  92.           entityY = entityCoords.y
  93.           entityZ = entityCoords.z
  94.           entityX1 = entityCoords1.x
  95.           entityY1 = entityCoords1.y
  96.           entityZ1 = entityCoords1.z         
  97. --this gets the entity rotation
  98.         entityRot = GetEntityRotation(a)
  99.         entityRot1 = GetEntityRotation(b)      
  100. --this splits up the rotation
  101.           entityRotX = entityRot.x
  102.           entityRotY = entityRot.y
  103.           entityRotZ = entityRot.z
  104.           entityRotX1 = entityRot1.x
  105.           entityRotY1 = entityRot1.y
  106.           entityRotZ1 = entityRot1.z         
  107.     end
  108. --if left shift is pressed then movement speed is slower
  109.     if IsControlPressed(0, 21) then
  110.         moveSpeed = 0.01
  111.         moveSpeed1 = 0.2
  112.     else
  113.         moveSpeed = 0.1
  114.         moveSpeed1 = 1.3
  115.      end
  116.  
  117. --this sets "a" to nil if no entity was spawned and no entity of type found near player
  118.       if not DoesEntityExist(a) then
  119.        a = nil
  120.       end
  121. --home key
  122. -- if control "home" key is pressed then it spawns the entity of your choosing   
  123.      if IsControlJustPressed(0, 213) then
  124.         Citizen.Wait(500)
  125.          spawnStuff(stuff)
  126.      end
  127. --left key
  128. -- if control "left" key is pressed then it adds 0.01 to the x coord
  129.      if DoesEntityExist(a) and IsControlPressed(0, 174) then
  130.       if frozen == false then
  131.         entityX = entityCoords.x + moveSpeed
  132.         --sets the entity's position with result
  133.         SetEntityCoords(a, entityX, entityY, entityZ)
  134.         entityX1 = entityCoords1.x + moveSpeed
  135.         --sets the entity's position with result
  136.         SetEntityCoords(b, entityX1, entityY1, entityZ1)           
  137.       end
  138.      end     
  139. --right key
  140. -- if control "right" key is pressed then it subtract's 0.01 from the x coord
  141.      if DoesEntityExist(a) and IsControlPressed(0, 175) then
  142.       if frozen == false then    
  143.         --entityCoords = GetEntityCoords(a)
  144.         entityX = entityCoords.x - moveSpeed
  145.         --sets the entity's position with result
  146.         SetEntityCoords(a, entityX, entityY, entityZ)
  147.         --entityCoords = GetEntityCoords(a)
  148.         entityX1 = entityCoords1.x - moveSpeed
  149.         --sets the entity's position with result
  150.         SetEntityCoords(b, entityX1, entityY1, entityZ1)           
  151.       end
  152.      end
  153. --pageup
  154. -- if control "pageUp" key is pressed then it adds 0.01 to the z coord
  155.      if DoesEntityExist(a) and IsControlPressed(0, 10) then
  156.       if frozen == false then
  157.         entityZ = entityCoords.z + moveSpeed
  158. --sets the entity's position with result
  159.         SetEntityCoords(a, entityX, entityY, entityZ)
  160.         entityZ1 = entityCoords1.z + moveSpeed
  161. --sets the entity's position with result
  162.         SetEntityCoords(b, entityX1, entityY1, entityZ1)           
  163.       end
  164.      end
  165. --pagedown
  166. -- if control "pageDown" key is pressed then it subtract's 0.01 from the z coord
  167.      if DoesEntityExist(a) and IsControlPressed(0, 11) then
  168.       if frozen == false then    
  169.         entityZ = entityCoords.z - moveSpeed
  170. --sets the entity's position with result
  171.         SetEntityCoords(a, entityX, entityY, entityZ)
  172.         entityZ1 = entityCoords1.z - moveSpeed
  173. --sets the entity's position with result
  174.         SetEntityCoords(b, entityX1, entityY1, entityZ1)       
  175.      end
  176.     end
  177. --up key
  178. -- if control "up" key is pressed then it subtract's 0.01 from the y coord
  179.      if DoesEntityExist(a) and IsControlPressed(0, 27) then
  180.       if frozen == false then    
  181.         entityY = entityCoords.y - moveSpeed     
  182. --sets the entity's position with result
  183.         SetEntityCoords(a, entityX, entityY, entityZ)
  184.         entityY1 = entityCoords1.y - moveSpeed   
  185. --sets the entity's position with result
  186.         SetEntityCoords(b, entityX1, entityY1, entityZ1)       
  187.       end
  188.      end
  189. --down key
  190. -- if control "down" key is pressed then it adds 0.01 to the y coord
  191.      if DoesEntityExist(a) and IsControlPressed(0, 173) then
  192.       if frozen == false then    
  193.         entityY = entityCoords.y + moveSpeed
  194.         SetEntityCoords(a, entityX, entityY, entityZ)
  195.         entityY1 = entityCoords1.y + moveSpeed
  196.         SetEntityCoords(b, entityX1, entityY1, entityZ1)           
  197.       end
  198.      end
  199.  
  200.      --leftshift AND "E"
  201. -- if left shift AND "E" key are pressed then it deletes the entity
  202. --and any other entity close to the player with the same hashkey
  203.      if IsControlPressed(0, 21) and IsControlPressed(0, 38) then
  204.         if DoesEntityExist(a) or DoesEntityExist(closestEntity) then
  205.          deleteStuff()
  206.         end
  207.      end
  208. --numberpad "+" key
  209. -- if numberpad "+" key is pressed then it adds 0.1 to the entity's heading(spins the thing)
  210.      if DoesEntityExist(a) and IsControlPressed(0, 96) then
  211.       if frozen == false then    
  212.         entityRotZ = entityRotZ + moveSpeed1     
  213. --sets the entity's heading with result
  214.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  215.         entityRotZ1 = entityRotZ1 + moveSpeed1   
  216. --sets the entity's heading with result
  217.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)    
  218.       end
  219.      end
  220. --numberpad "-" key
  221. -- if numberpad "-" key is pressed then it subtract's 0.1 from the entity's heading(spins the thing)
  222.      if DoesEntityExist(a) and IsControlPressed(0, 97) then
  223.       if frozen == false then
  224.         entityRotZ = entityRotZ - moveSpeed1           
  225.         --sets the entity's heading with result
  226.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  227.         entityRotZ1 = entityRotZ1 - moveSpeed1         
  228.         --sets the entity's heading with result
  229.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)    
  230.       end
  231.      end
  232.      --the "[" key
  233.      if DoesEntityExist(a) and IsControlPressed(0, 39) then
  234.       if frozen == false then
  235.         --entityRot = GetEntityRotation(a)
  236.         entityRotY = entityRotY + moveSpeed1
  237.         --sets the entity's rotation with result
  238.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  239.         --entityRot = GetEntityRotation(a)
  240.         entityRotY1 = entityRotY1 + moveSpeed1
  241.         --sets the entity's rotation with result
  242.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)    
  243.       end
  244.      end
  245.      -- the "]" key
  246.      if (DoesEntityExist(a) and IsControlPressed(0, 40)) then
  247.       if frozen == false then      
  248.         --entityRot = GetEntityRotation(a)     
  249.         entityRotY = entityRotY - moveSpeed1       
  250.         --sets the entity's rotation with result
  251.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  252.             --entityRot = GetEntityRotation(a)     
  253.         entityRotY1 = entityRotY1 - moveSpeed1     
  254.         --sets the entity's rotation with result
  255.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
  256.       end
  257.      end
  258.      -- the "-" key
  259.      if (DoesEntityExist(a) and IsControlPressed(0, 84)) then
  260.       if frozen == false then
  261.         --entityRot = GetEntityRotation(a)     
  262.         entityRotX = entityRotX - moveSpeed1       
  263.         --sets the entity's rotation with result
  264.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  265.             --entityRot = GetEntityRotation(a)     
  266.         entityRotX1 = entityRotX1 - moveSpeed1     
  267.         --sets the entity's rotation with result
  268.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
  269.       end
  270.      end
  271.      -- the "=" key
  272.      if (DoesEntityExist(a) and IsControlPressed(0, 83)) then
  273.       if frozen == false then      
  274.         --entityRot = GetEntityRotation(a)     
  275.         entityRotX = entityRotX + moveSpeed1       
  276.         --sets the entity's rotation with result
  277.         SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
  278.             --entityRot = GetEntityRotation(a)     
  279.         entityRotX1 = entityRotX1 + moveSpeed1     
  280.         --sets the entity's rotation with result
  281.         SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
  282.       end
  283.      end     
  284.     end
  285. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement