SycroX Posted July 19, 2016 Share Posted July 19, 2016 Hi all i have got a problem with Submarine i have Create a Submarine and it work good but i don't know how to make it go down i try setElementPosition but when it go down it go up again so i need some help Link to comment
SycroX Posted July 19, 2016 Author Share Posted July 19, 2016 hello ? any body can help me ? Link to comment
Walid Posted July 19, 2016 Share Posted July 19, 2016 hello ? any body can help me ? All what you need is: isPedInVehicle() getPedOccupiedVehicle() isElementInWater() getElementPosition() setElementPosition() getWaterLevel() Link to comment
SycroX Posted July 19, 2016 Author Share Posted July 19, 2016 hello ? any body can help me ? All what you need is: isPedInVehicle() getPedOccupiedVehicle() isElementInWater() getElementPosition() setElementPosition() i try to do this but it make the submarine go up Link to comment
Walid Posted July 19, 2016 Share Posted July 19, 2016 i try to do this but it make the submarine go up Use getWaterLevel() Link to comment
SycroX Posted July 19, 2016 Author Share Posted July 19, 2016 how dose this function will be usefull to me it get the water level . how can if be usefull to me see the sub marine is a ship Link to comment
Syntrax# Posted July 19, 2016 Share Posted July 19, 2016 how dose this function will be usefull to me it get the water level . how can if be usefull to me see the sub marine is a ship CurrentDepth = 0 function MoveSubmarine() local Waterlevel = getWaterLevel() local x, y, z = getElementPosition(theobject) local check = isElementInWater(theobject) local vehiclecheck = isPedInVehicle ( source ) if getKeyState( "arrow_u" ) == true and check == true and vehiclecheck == true then CurrentDepth = CurrentDepth + 1 setElementPosition(theobject, x, y, z - CurrentDepth) elseif getKeyState( "arrow_d" ) == true and check == true and vehiclecheck == true then CurrentDepth = CurrentDepth - 1 setElementPosition(theobject, x, y, z - CurrentDepth) end end Will make a proper code later on, i'm currently scripting it on my phone.Will fix it once i'm home Link to comment
SycroX Posted July 20, 2016 Author Share Posted July 20, 2016 how dose this function will be usefull to me it get the water level . how can if be usefull to me see the sub marine is a ship CurrentDepth = 0 function MoveSubmarine() local Waterlevel = getWaterLevel() local x, y, z = getElementPosition(theobject) local check = isElementInWater(theobject) local vehiclecheck = isPedInVehicle ( source ) if getKeyState( "arrow_u" ) == true and check == true and vehiclecheck == true then CurrentDepth = CurrentDepth + 1 setElementPosition(theobject, x, y, z - CurrentDepth) elseif getKeyState( "arrow_d" ) == true and check == true and vehiclecheck == true then CurrentDepth = CurrentDepth - 1 setElementPosition(theobject, x, y, z - CurrentDepth) end end Will make a proper code later on, i'm currently scripting it on my phone.Will fix it once i'm home your code is wrong there is something is undefind like source ? what is this from where you get is i don't see any event Link to comment
SycroX Posted July 20, 2016 Author Share Posted July 20, 2016 i try to do this code but i shoud give the sub freeze and it dosen't drive will when i press w it go forword and left in the same time addEventHandler( "onClientKey", root, function(button,press) local vehicle = getPedOccupiedVehicle(localPlayer) local x, y, z = getElementPosition(vehicle) local rx, ry, rz = getElementRotation(vehicle) if isElementInWater(vehicle) then if button == "arrow_d" then if press == true and getElementModel(vehicle) == 484 then setElementPosition(vehicle, x, y, z - 1) setElementFrozen(vehicle, true) end elseif button == "w" then if z > -2 then return end setElementPosition(vehicle, x, y+1, z) elseif button == "s" then if z > -2 then return end setElementPosition(vehicle, x, y-1, z) elseif button == "a" then if z > -2 then return end setElementPosition(vehicle, x+1, y, z) setElementRotation(vehicle, rx, ry, rz+1) elseif button == "d" then if z > -2 then return end setElementPosition(vehicle, x-1, y, z) setElementRotation(vehicle, rx, ry, rz-1) elseif button == "arrow_u" then if press == true and getElementModel(vehicle) == 484 then setElementPosition(vehicle, x, y, z + 1) if z >= -2 then setElementFrozen(vehicle, false) end end end end end) Link to comment
SycroX Posted July 20, 2016 Author Share Posted July 20, 2016 Hello Please any body can help me ? Link to comment
Syntrax# Posted July 20, 2016 Share Posted July 20, 2016 Hello Please any body can help me ? Serverside or Clientside, since i did the thing serversided Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now