Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Citizen.CreateThread(function()
- while true do
- if IsControlPressed(0, 21) and IsControlJustPressed(1, 168) then
- showInfo = not showInfo
- end
- Citizen.Wait(0)
- playerPed = GetPlayerPed(PlayerId())
- playerCoords = GetEntityCoords(GetPlayerPed(PlayerId()), true)
- playerCoordsX = playerCoords.x
- playerCoordsY = playerCoords.y
- playerCoordsZ = playerCoords.z
- playerHeading = GetEntityHeading(GetPlayerPed(PlayerId()))
- PlayerRoomKey = GetRoomKeyFromEntity(GetPlayerPed(PlayerId()))
- playerInteriorID = GetInteriorFromEntity(GetPlayerPed(PlayerId()))
- entityRoomKey = GetRoomKeyFromEntity(a)
- entityInteriorID = GetInteriorFromEntity(a)
- entityCoords = GetEntityCoords(closestEntity, true)
- interiorGroupID = GetInteriorGroupId(entityInteriorID)
- ForceRoomForEntity(a, playerInteriorID, PlayerRoomKey)
- EntityInterior = GetInteriorFromEntity(a)
- EntityRoomKey = GetRoomKeyFromEntity(a)
- if showInfo then
- --SetNetworkIdExistsOnAllMachines(dude10, true)
- --NetworkRegisterEntityAsNetworked(dude10)
- --NetworkSetEntityVisibleToNetwork(dude10, true)
- requestControl = NetworkRequestControlOfEntity(dude10)
- local entityCoords = GetEntityCoords(dude10)
- local entityRot = GetEntityRotation(dude10, 2)
- local playerRot = GetEntityRotation(GetPlayerPed(), 2)
- local playerCoords = GetEntityCoords(GetPlayerPed())
- local isEntityNetworked = NetworkHasControlOfEntity(dude10)
- entityNetworkID = NetworkGetNetworkIdFromEntity(dude10)
- doesEntityExist = NetworkDoesNetworkIdExist(NetworkGetNetworkIdFromEntity(dude10))
- SetEntityAsMissionEntity(dude10, 1, 0)
- DrawSprite("shared","bggradient", 0.85, 0.39, 0.28, 0.60, 90.0, 0, 0, 0, 200)
- drawTxt('DEBUG INFO ', 6, 1, 0.88, 0.097 , 0.5, 255, 0, 0, 255)
- drawTxt('entity ID: ', 6, 1, 0.80, 0.125 , 0.6, 255, 255, 255, 255)
- drawTxt(tostring(dude10), 6, 1, 0.91, 0.125 , 0.6, 0, 255, 255, 255)
- drawTxt('entity model hash: ', 6, 1, 0.80, 0.150 , 0.6, 255, 255, 255, 255)
- drawTxt(tostring(GetEntityModel(dude10)), 6, 1, 0.91, 0.150 , 0.6, 0, 255, 255, 255)
- drawTxt('entity interior: ', 6, 1, 0.80, 0.177, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(GetInteriorFromEntity(dude10)) , 6, 1, 0.91, 0.177, 0.6, 0, 255, 255, 255)
- drawTxt('networkID: ', 6, 1, 0.80, 0.200, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(NetworkGetNetworkIdFromEntity(dude10)) , 6, 1, 0.91, 0.200, 0.6, 0, 255, 255, 255)
- drawTxt('is entity networked: ', 6, 1, 0.81, 0.230, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(isEntityNetworked) , 6, 1, 0.91, 0.230, 0.6, 0, 255, 255, 255)
- drawTxt('requestControl', 6, 1, 0.81, 0.260, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(requestControl) , 6, 1, 0.91, 0.260, 0.6, 0, 255, 255, 255)
- drawTxt('doesEntityExist', 6, 1, 0.81, 0.290, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(doesEntityExist) , 6, 1, 0.91, 0.290, 0.6, 0, 255, 255, 255)
- drawTxt('entity X coords: ', 6, 1, 0.80, 0.320, 0.6 , 0, 255, 0, 255)
- drawTxt(tostring(entityCoords.x) , 6, 1, 0.91, 0.320, 0.6, 0, 255, 0, 255)
- drawTxt("entity Y coords: ", 6, 1, 0.80, 0.350, 0.6, 0, 255, 0, 255)
- drawTxt(tostring(entityCoords.y) , 6, 1, 0.91, 0.350, 0.6, 0, 255, 0, 255)
- drawTxt("entity Z coords: ", 6, 1, 0.80, 0.380, 0.6, 0, 255, 0, 255)
- drawTxt(tostring(entityCoords.z) , 6, 1, 0.91, 0.380, 0.6, 0, 255, 0, 255)
- drawTxt('entity X rotation: ', 6, 1, 0.80, 0.410, 0.6, 0, 255, 0, 255)
- drawTxt(tostring(entityRot.x) , 6, 1, 0.91, 0.410, 0.6, 0, 255, 0, 255)
- drawTxt('entity Y rotation: ', 6, 1, 0.80, 0.440, 0.6, 0, 255, 0, 255)
- drawTxt(tostring(entityRot.y) , 6, 1, 0.91, 0.440, 0.6, 0, 255, 0, 255)
- drawTxt('entity Z rotation: ', 6, 1, 0.80, 0.470, 0.6, 0, 255, 0, 255)
- drawTxt(tostring(entityRot.z) , 6, 1, 0.91, 0.470, 0.6, 0, 255, 0, 255)
- drawTxt('Player X rotation: ', 6, 1, 0.80, 0.500, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerRot.x) , 6, 1, 0.91, 0.500, 0.6, 0, 0, 255, 255)
- drawTxt('Player Y rotation: ', 6, 1, 0.80, 0.530, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerRot.y) , 6, 1, 0.91, 0.530, 0.6, 0, 0, 255, 255)
- drawTxt('Player Z rotation: ', 6, 1, 0.80, 0.560, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerRot.z) , 6, 1, 0.91, 0.560, 0.6, 0, 0, 255, 255)
- drawTxt('Player X position: ', 6, 1, 0.80, 0.590, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerCoords.x) , 6, 1, 0.91, 0.590, 0.6, 0, 255, 0, 255)
- drawTxt('Player Y position: ', 6, 1, 0.80, 0.620, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerCoords.y) , 6, 1, 0.91, 0.620, 0.6, 0, 255, 0, 255)
- drawTxt('Player Z position: ', 6, 1, 0.80, 0.650, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(playerCoords.z) , 6, 1, 0.91, 0.650, 0.6, 0, 255, 0, 255)
- drawTxt('Player Heading: ', 6, 1, 0.80, 0.690, 0.6, 255, 255, 255, 255)
- drawTxt(tostring(GetEntityHeading(GetPlayerPed())) , 6, 1, 0.91, 0.690, 0.6, 0, 255, 0, 255)
- end
- -----------------------------------------------------------------------------------------------------------------------------------------------------
- ---------------------------------this checks if the spawned entity exists and moves it as player pushes buttons---------------------------------------
- -----------------------------------------------------------------------------------------------------------------------------------------------------
- if not DoesEntityExist(a) or DoesEntityExist(GetClosestObjectOfType(playerCoordsX, playerCoordsY, playerCoordsZ, 50.0, stuff, 0, 1, 0)) then
- a = GetClosestObjectOfType(playerCoordsX, playerCoordsY, playerCoordsZ, 50.0, stuff, 0, 1, 0)
- end
- if DoesEntityExist(a) then
- b = ObjToNet(a)
- --this gets the entity coords
- entityCoords = GetEntityCoords(a)
- entityCoords1 = GetEntityCoords(b)
- --this splits up the coords
- entityX = entityCoords.x
- entityY = entityCoords.y
- entityZ = entityCoords.z
- entityX1 = entityCoords1.x
- entityY1 = entityCoords1.y
- entityZ1 = entityCoords1.z
- --this gets the entity rotation
- entityRot = GetEntityRotation(a)
- entityRot1 = GetEntityRotation(b)
- --this splits up the rotation
- entityRotX = entityRot.x
- entityRotY = entityRot.y
- entityRotZ = entityRot.z
- entityRotX1 = entityRot1.x
- entityRotY1 = entityRot1.y
- entityRotZ1 = entityRot1.z
- end
- --if left shift is pressed then movement speed is slower
- if IsControlPressed(0, 21) then
- moveSpeed = 0.01
- moveSpeed1 = 0.2
- else
- moveSpeed = 0.1
- moveSpeed1 = 1.3
- end
- --this sets "a" to nil if no entity was spawned and no entity of type found near player
- if not DoesEntityExist(a) then
- a = nil
- end
- --home key
- -- if control "home" key is pressed then it spawns the entity of your choosing
- if IsControlJustPressed(0, 213) then
- Citizen.Wait(500)
- spawnStuff(stuff)
- end
- --left key
- -- if control "left" key is pressed then it adds 0.01 to the x coord
- if DoesEntityExist(a) and IsControlPressed(0, 174) then
- if frozen == false then
- entityX = entityCoords.x + moveSpeed
- --sets the entity's position with result
- SetEntityCoords(a, entityX, entityY, entityZ)
- entityX1 = entityCoords1.x + moveSpeed
- --sets the entity's position with result
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --right key
- -- if control "right" key is pressed then it subtract's 0.01 from the x coord
- if DoesEntityExist(a) and IsControlPressed(0, 175) then
- if frozen == false then
- --entityCoords = GetEntityCoords(a)
- entityX = entityCoords.x - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(a, entityX, entityY, entityZ)
- --entityCoords = GetEntityCoords(a)
- entityX1 = entityCoords1.x - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --pageup
- -- if control "pageUp" key is pressed then it adds 0.01 to the z coord
- if DoesEntityExist(a) and IsControlPressed(0, 10) then
- if frozen == false then
- entityZ = entityCoords.z + moveSpeed
- --sets the entity's position with result
- SetEntityCoords(a, entityX, entityY, entityZ)
- entityZ1 = entityCoords1.z + moveSpeed
- --sets the entity's position with result
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --pagedown
- -- if control "pageDown" key is pressed then it subtract's 0.01 from the z coord
- if DoesEntityExist(a) and IsControlPressed(0, 11) then
- if frozen == false then
- entityZ = entityCoords.z - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(a, entityX, entityY, entityZ)
- entityZ1 = entityCoords1.z - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --up key
- -- if control "up" key is pressed then it subtract's 0.01 from the y coord
- if DoesEntityExist(a) and IsControlPressed(0, 27) then
- if frozen == false then
- entityY = entityCoords.y - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(a, entityX, entityY, entityZ)
- entityY1 = entityCoords1.y - moveSpeed
- --sets the entity's position with result
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --down key
- -- if control "down" key is pressed then it adds 0.01 to the y coord
- if DoesEntityExist(a) and IsControlPressed(0, 173) then
- if frozen == false then
- entityY = entityCoords.y + moveSpeed
- SetEntityCoords(a, entityX, entityY, entityZ)
- entityY1 = entityCoords1.y + moveSpeed
- SetEntityCoords(b, entityX1, entityY1, entityZ1)
- end
- end
- --leftshift AND "E"
- -- if left shift AND "E" key are pressed then it deletes the entity
- --and any other entity close to the player with the same hashkey
- if IsControlPressed(0, 21) and IsControlPressed(0, 38) then
- if DoesEntityExist(a) or DoesEntityExist(closestEntity) then
- deleteStuff()
- end
- end
- --numberpad "+" key
- -- if numberpad "+" key is pressed then it adds 0.1 to the entity's heading(spins the thing)
- if DoesEntityExist(a) and IsControlPressed(0, 96) then
- if frozen == false then
- entityRotZ = entityRotZ + moveSpeed1
- --sets the entity's heading with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- entityRotZ1 = entityRotZ1 + moveSpeed1
- --sets the entity's heading with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- --numberpad "-" key
- -- if numberpad "-" key is pressed then it subtract's 0.1 from the entity's heading(spins the thing)
- if DoesEntityExist(a) and IsControlPressed(0, 97) then
- if frozen == false then
- entityRotZ = entityRotZ - moveSpeed1
- --sets the entity's heading with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- entityRotZ1 = entityRotZ1 - moveSpeed1
- --sets the entity's heading with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- --the "[" key
- if DoesEntityExist(a) and IsControlPressed(0, 39) then
- if frozen == false then
- --entityRot = GetEntityRotation(a)
- entityRotY = entityRotY + moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- --entityRot = GetEntityRotation(a)
- entityRotY1 = entityRotY1 + moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- -- the "]" key
- if (DoesEntityExist(a) and IsControlPressed(0, 40)) then
- if frozen == false then
- --entityRot = GetEntityRotation(a)
- entityRotY = entityRotY - moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- --entityRot = GetEntityRotation(a)
- entityRotY1 = entityRotY1 - moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- -- the "-" key
- if (DoesEntityExist(a) and IsControlPressed(0, 84)) then
- if frozen == false then
- --entityRot = GetEntityRotation(a)
- entityRotX = entityRotX - moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- --entityRot = GetEntityRotation(a)
- entityRotX1 = entityRotX1 - moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- -- the "=" key
- if (DoesEntityExist(a) and IsControlPressed(0, 83)) then
- if frozen == false then
- --entityRot = GetEntityRotation(a)
- entityRotX = entityRotX + moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(a, entityRotX, entityRotY, entityRotZ)
- --entityRot = GetEntityRotation(a)
- entityRotX1 = entityRotX1 + moveSpeed1
- --sets the entity's rotation with result
- SetEntityRotation(b, entityRotX1, entityRotY1, entityRotZ1)
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement