Jump to content

Flying Airplane


Matevsz

Recommended Posts

Posted

You need someone to stream it, obviously. Your server cannot stream pedestrians unless you craft your own rendering system server-side, which is quite heavy. And stupid.

What I suggest is you simply disable streaming for a ped element and a vehicle element, and then just control the pedestrian while it's in air. I built a script for this a while ago and it works quite well, just need some math to keep the plane stable.

Posted (edited)

I wanted to do it with markers, unfortunately I can not loop so wrote out all the steps to moveObject but does not work

  
airship = createVehicle(592, 1921.3000488281, -1735.1999511719, 158*272) 
  
markeryLS { 
a = createMarker(2185.8000488281, -1723.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
b = createMarker(2620, -1764.8000488281, 170, "ring", 1.5, 0, 0, 0, 0) 
c = createMarker(2649.6999511719, -1188.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
d = createMarker(1378.1999511719, -911.59997558594, 170, "ring", 1.5, 0, 0, 0, 0) 
e = createMarker(740, -1061.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
f = createMarker(443.89999389648, -1608.4000244141, 170, "ring", 1.5, 0, 0, 0, 0) 
g = createMarker(1893, -1736.5, 170, "ring", 1.5, 0, 0, 0, 0) 
} 
  
addEventHandler("onMarkerHit",markeryLS, 
function(vehicle) 
    if getElementType(vehicle)=="vehicle" then 
        if source == markeryLS then 
            moveObject(airship, 600000, 2185.8000488281, -1723.1999511719, 170) 
        end 
    end 
end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 2620, -1764.8000488281, 170) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 2649.6999511719, -1188.1999511719, 170) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 1378.1999511719, -911.59997558594, 170) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 740, -1061.1999511719, 170) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 443.89999389648, -1608.4000244141, 170) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 1893, -1736.5, 170) 
            end 
        end 
    end 
) 
  

Edited by Guest
Posted

If you want to do it like that, then you need to have an object, and then you use attachElements to attach the vehicle to the object. Then you move the object, and the vehicle will move with it. This is a pretty lame way of doing the movement, just saying. It doesn't look nice either.

Posted (edited)

Could you give an example of how would you can do it?

  
local airship = createVehicle(592, 1921.3000488281, -1735.1999511719, 158*272) 
  
markeryLS { 
a = createMarker(2185.8000488281, -1723.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
b = createMarker(2620, -1764.8000488281, 170, "ring", 1.5, 0, 0, 0, 0) 
c = createMarker(2649.6999511719, -1188.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
d = createMarker(1378.1999511719, -911.59997558594, 170, "ring", 1.5, 0, 0, 0, 0) 
e = createMarker(740, -1061.1999511719, 170, "ring", 1.5, 0, 0, 0, 0) 
f = createMarker(443.89999389648, -1608.4000244141, 170, "ring", 1.5, 0, 0, 0, 0) 
g = createMarker(1893, -1736.5, 170, "ring", 1.5, 0, 0, 0, 0) 
} 
  
addEventHandler("onMarkerHit",markeryLS, 
function(vehicle) 
    if getElementType(vehicle)=="vehicle" then 
        if source == markeryLS then 
            moveObject(airship, 600000, 2185.8000488281, -1723.1999511719, 170) 
            attachElements(airship, a, 0, 0, 0) 
        end 
    end 
end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 2620, -1764.8000488281, 170) 
                attachElements(airship, b, 0, 0, 0) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 2649.6999511719, -1188.1999511719, 170) 
                attachElements(airship, c, 0, 0, 0) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airshipc, 600000, 1378.1999511719, -911.59997558594, 170) 
                attachElements(airship, d, 0, 0, 0) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 740, -1061.1999511719, 170) 
                attachElements(airship, e, 0, 0, 0) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 443.89999389648, -1608.4000244141, 170) 
                attachElements(airship, f, 0, 0, 0) 
            end 
        end 
    end 
) 
  
addEventHandler("onMarkerHit",markeryLS, 
    function(vehicle) 
        if getElementType(vehicle)=="vehicle" then 
            if source == markeryLS then 
                moveObject(airship, 600000, 1893, -1736.5, 170) 
                attachElements(airship, g, 0, 0, 0) 
            end 
        end 
    end 
) 
  

Edited by Guest
Posted

If you want the airplane to fly right, you can have it check the altitude every so often, if it gets to low aim it up, if it gets to high aim it down, stuff along the lines of that. btw put your code in [lua][./lua] brackets instead of

[./code]
Posted

I know it is not easy, I learn lua but how can I learn if you do not know what is wrong? :)

I removed * 272 with ruler createVehicle and createVehicle swapped for CreateObject because it's probably not going to hook moveObject under createVehicle

Instead of the model aircraft (592) on the object model (1683), but does not work

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...