Jump to content

[HELP] : Submarine Script


SycroX

Recommended Posts

Posted

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

Chillin' with some demons, satans and vamps

Posted
hello ?

any body can help me ?

All what you need is:

isPedInVehicle() 
getPedOccupiedVehicle() 
isElementInWater() 
getElementPosition() 
setElementPosition() 
getWaterLevel() 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
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

Chillin' with some demons, satans and vamps

Posted
i try to do this but it make the submarine go up

Use

getWaterLevel() 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

:?: 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

Chillin' with some demons, satans and vamps

Posted
:?: 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

Nothing is impossible when you acquire the knowledge
 
Posted
:?: 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

Chillin' with some demons, satans and vamps

Posted

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) 

Chillin' with some demons, satans and vamps

Posted
Hello Please any body can help me ?

Serverside or Clientside, since i did the thing serversided

Nothing is impossible when you acquire the knowledge
 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...