Jump to content

gatemaker problem


Adde

Recommended Posts

This gatemaker from community got a problem on latest version of mta, i don´t know how to fix it but I hope someone can!

debug: WARNING: [gameplay]/gatemaker/gateloader.lua:85: Bad argument @ "moveobject" [Expected easing-type at argument 9, got number "0" ]

server.lua

Editor      = {} 
Gate        = {}
Gate2       = {}
Precision   = {}
status      = {}
coll        = {}
coll2        = {}
coll3        = {}
coll4        = {}
 
 -- this script mod is (no longer) PRIVATE
 -- - Deject3d
 
function startBuilding(playerSource, commandName, objectid)
    if not objectid then
        outputChatBox("usage: /addgate objectid teamname", playerSource)
    end
       
    team = getTeamName(getPlayerTeam(playerSource))
    if team == false then
        team = ""
    end
    for i = 1,20 do
        if Editor[i] == playerSource then
            destroyElement(Gate[i])
            Gate[i] = null
            Editor[i] = null
            Precision[i] = null
        end
        if Editor[i] == null then
            Editor[i] = playerSource -- set Editor[i] to who made the object
 
                --creating object -v
            local x,y,z = getElementPosition(playerSource)
            object = createObject ( objectid, x + 3,y + 3,z)
            interior = getElementInterior ( playerSource )
            setElementInterior(object,interior)
                --created object -^
 
            Gate[i] = object -- added object identifier to the array, corresponds to who created it
            Precision[i] = .5   -- default precision
 
            bindKey(playerSource, "i",        "down", moveIt)
            bindKey(playerSource, "j",        "down", moveIt)
            bindKey(playerSource, "k",        "down", moveIt)
            bindKey(playerSource, "l",        "down", moveIt)
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt)
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt)
            bindKey(playerSource, "pgup",         "down", moveIt)
            bindKey(playerSource, "pgdn",         "down", moveIt)
 
            bindKey(playerSource, "u",        "down", moveIt)
            bindKey(playerSource, "o",        "down", moveIt)
 
            bindKey(playerSource, "[",        "down", moveIt)
            bindKey(playerSource, "]",        "down", moveIt)
 
            bindKey(playerSource, "enter",        "down", nextPosition ,objectid, team)
            bindKey(playerSource, "delete",       "down", removeIt, playerSource)
 
            break -- done adding our object and who created it to the arrays... stop the loop
        end
    end
 
end
 
function nextPosition(playerSource, key, keyState, objectid, team)
            unbindKey ( playerSource, "i"               )
            unbindKey ( playerSource, "j"               )
            unbindKey ( playerSource, "k"               )
            unbindKey ( playerSource, "l"               )
            unbindKey ( playerSource, "pgup"            )
            unbindKey ( playerSource, "pgdn"            )
            unbindKey ( playerSource, "mouse_wheel_down")
            unbindKey ( playerSource, "mouse_wheel_up"  )
            unbindKey ( playerSource, "enter"           )
            unbindKey ( playerSource, "delete"          )
            unbindKey ( playerSource, "u"               )
            unbindKey ( playerSource, "o"               )
            unbindKey ( playerSource, "["               )
            unbindKey ( playerSource, "]"               )
 
    outputDebugString("object 1 set. object 2 controlled. ID: " .. objectid .." team: " .. team .. "")
    for i = 1,20 do
        if Editor[i] == playerSource then
 
                --creating object -v
            local x,y,z = getElementPosition(Gate[i])
            local rx,ry,rz= getObjectRotation(Gate[i])
            object = createObject ( objectid, x,y,z,rx,ry,rz)
            interior = getElementInterior ( playerSource )
            setElementInterior(object,interior)
                --created object -^
 
            Gate2[i] = object -- added object identifier to the array, corresponds to who created it
            Precision[i] = .5   -- default precision
 
            bindKey(playerSource, "i",        "down", moveIt2)
            bindKey(playerSource, "j",        "down", moveIt2)
            bindKey(playerSource, "k",        "down", moveIt2)
            bindKey(playerSource, "l",        "down", moveIt2)
            bindKey(playerSource, "mouse_wheel_up",   "down", moveIt2)
            bindKey(playerSource, "mouse_wheel_down", "down", moveIt2)
            bindKey(playerSource, "pgup",         "down", moveIt2)
            bindKey(playerSource, "pgdn",         "down", moveIt2)
 
            bindKey(playerSource, "u",        "down", moveIt2)
            bindKey(playerSource, "o",        "down", moveIt2)
 
            bindKey(playerSource, "[",        "down", moveIt2)
            bindKey(playerSource, "]",        "down", moveIt2)
 
            bindKey(playerSource, "enter",        "down", collisionObject, team, objectID)
            bindKey(playerSource, "delete",       "down", removeIt, playerSource)
 
            break -- done adding our object and who created it to the arrays... stop the loop
        end
    end
end
 
function changePrecision(playerSource,commandName,value)
    if value then
        for i = 1,20 do
            if Editor[i] == playerSource then
                Precision[i] = value
                outputChatBox("Sensitivity set to: " .. value .. "", playerSource)
                break
            end
        end
    end
end
 
 
function moveIt(source, key, keyState)
    for i = 1,20 do
        if Editor[i] == source then
            object = Gate[i]
            prec = Precision[i]
            break
        end
    end
   
    if key == "i" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y + prec,z )
    end
    if key =="j" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x - prec,y,z )
    end
    if key =="l" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x + prec,y,z )
    end
    if key =="k" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y - prec,z )
    end
    if key =="pgup" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y,z + prec )
    end
    if key =="pgdn" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y ,z - prec )
    end
 -- rotation --
    if key =="mouse_wheel_up" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry,rz - prec * 5)
    end
    if key =="mouse_wheel_down" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry,rz + prec * 5)
    end
    if key =="u" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry - prec*10,rz)
    end
    if key =="o" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry + prec*10,rz)
    end
    if key =="[" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx- prec*10,ry,rz)
    end
    if key =="]" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx+ prec*10,ry,rz)
    end
end
 
function moveIt2(source, key, keyState)
    for i = 1,20 do
        if Editor[i] == source then
            object = Gate2[i]
            prec = Precision[i]
            break
        end
    end
   
    if key == "i" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y + prec,z )
    end
    if key =="j" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x - prec,y,z )
    end
    if key =="l" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x + prec,y,z )
    end
    if key =="k" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y - prec,z )
    end
    if key =="pgup" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y,z + prec )
    end
    if key =="pgdn" then
        x,y,z = getElementPosition(object)
        setElementPosition ( object, x,y ,z - prec )
    end
 -- rotation --
    if key =="mouse_wheel_up" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry,rz - prec * 5)
    end
    if key =="mouse_wheel_down" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry,rz + prec * 5)
    end
    if key =="u" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry - prec*10,rz)
    end
    if key =="o" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx,ry + prec*10,rz)
    end
    if key =="[" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx- prec*10,ry,rz)
    end
    if key =="]" then
        rx,ry,rz = getObjectRotation(object)
        setObjectRotation ( object, rx+ prec*10,ry,rz)
    end
Link to comment

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