Jump to content

Marker+MoveObject=Bad Argument


HunT

Recommended Posts

noob = :mrgreen:

local vehicle = getPedOccupiedVehicle(player)

hi all.i have problem with this script.

if source == Marker[1] then 
        local x, y, z = getElementPosition ( source )  
        local rx, ry, rz = getElementRotation ( source )  
      local ramp = createObject ( 1634, x, y, z, rx, ry, rz )  
      attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 )   
      move1 = moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) 
      bindKey ( "mouse2", "down", move1 ) 

createObject work

attachElements work

moveObject no

bindKey no

debugscript 3 = ERROR: attempt to call a boolean value

Sorry i am . . . :mrgreen: scripter

Link to comment

Client side yep castillo.

--[[ 
    ===================================================== 
    Racemap : Mortal Kombat v2 
    ===================================================== 
]]-- 
  
local root = getRootElement() 
local this = getThisResource() 
local resourceRoot = getResourceRootElement(this) 
local localPlayer = getLocalPlayer() 
local Marker = {} 
  
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0) 
         
        outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) 
         
         
        local stereo1 = engineLoadTXD ( "shade.txd" ) 
        engineImportTXD ( stereo1, 3458 ) 
         
         
        setCloudsEnabled ( false ) 
        setMinuteDuration(60000) 
  
        setTimer (function() 
        setTime (0, 0) 
        end 
        , 60000, 0)     
         
        setWaterColor( 100, 0, 0 ) 
        setWaveHeight ( 0 ) 
        setSkyGradient( 100, 0, 0, 100, 0, 0 ) 
         
         
         
         
         
    end 
) 
  
addEventHandler("onClientResourceStop", root, 
    function(res) 
        if res == this then 
             
             
     
        end 
    end 
) 
  
addEventHandler("onClientMarkerHit", root, 
    function(player, matchingDimension) 
        if not matchingDimension then return end 
         
        if player == localPlayer and isPedInVehicle(player) then 
            local vehicle = getPedOccupiedVehicle(player) 
  
             
            if source == Marker[1] then 
        local x, y, z = getElementPosition ( source )  
        local rx, ry, rz = getElementRotation ( source )  
      local ramp = createObject ( 1634, x, y, z, rx, ry, rz )  
      attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 )   
      move1 = moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) 
      bindKey ( "mouse2", "down", move1 ) 
  
       
               
                 
                 
            end 
        end 
    end 
) 
  
  

I always use this script for my maps.

My question: is it possible to move an attached object to the vehicle?

Link to comment

I'm afraid your post makes no sense, qais.

Back on the problem: You can't attach a bind to an ELEMENT, you need a function for that, try this code:

--[[ 
    ===================================================== 
    Racemap : Mortal Kombat v2 
    ===================================================== 
]]-- 
  
local root = getRootElement() 
local this = getThisResource() 
local resourceRoot = getResourceRootElement(this) 
local localPlayer = getLocalPlayer() 
local Marker = {} 
   
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0)       
        outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) 
        local stereo1 = engineLoadTXD ( "shade.txd" ) 
        engineImportTXD ( stereo1, 3458 ) 
        setCloudsEnabled ( false ) 
        setMinuteDuration(60000) 
        setTimer (function() 
        setTime (0, 0) 
        end 
        , 60000, 0)          
        setWaterColor( 100, 0, 0 ) 
        setWaveHeight ( 0 ) 
        setSkyGradient( 100, 0, 0, 100, 0, 0 ) 
    end 
) 
  
addEventHandler("onClientResourceStop", root, 
    function(res) 
        if res == this then 
        end 
    end 
) 
  
addEventHandler("onClientMarkerHit", root, 
function(player, matchingDimension) 
      if not matchingDimension then return end        
      if player == localPlayer and isPedInVehicle(player) then 
      local vehicle = getPedOccupiedVehicle(player) 
      if source == Marker[1] then 
      local x, y, z = getElementPosition ( source ) 
      local rx, ry, rz = getElementRotation ( source ) 
      ramp = createObject ( 1634, x, y, z, rx, ry, rz ) 
      attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 )  
      bindKey ( "mouse2", "down", function ()  moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) end) 
            end 
        end 
    end 
) 

Link to comment
I'm afraid your post makes no sense, qais.

Back on the problem: You can't attach a bind to an ELEMENT, you need a function for that, try this code:

--[[ 
    ===================================================== 
    Racemap : Mortal Kombat v2 
    ===================================================== 
]]-- 
  
local root = getRootElement() 
local this = getThisResource() 
local resourceRoot = getResourceRootElement(this) 
local localPlayer = getLocalPlayer() 
local Marker = {} 
   
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0)       
        outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) 
        local stereo1 = engineLoadTXD ( "shade.txd" ) 
        engineImportTXD ( stereo1, 3458 ) 
        setCloudsEnabled ( false ) 
        setMinuteDuration(60000) 
        setTimer (function() 
        setTime (0, 0) 
        end 
        , 60000, 0)          
        setWaterColor( 100, 0, 0 ) 
        setWaveHeight ( 0 ) 
        setSkyGradient( 100, 0, 0, 100, 0, 0 ) 
    end 
) 
  
addEventHandler("onClientResourceStop", root, 
    function(res) 
        if res == this then 
        end 
    end 
) 
  
addEventHandler("onClientMarkerHit", root, 
function(player, matchingDimension) 
      if not matchingDimension then return end        
      if player == localPlayer and isPedInVehicle(player) then 
      local vehicle = getPedOccupiedVehicle(player) 
      if source == Marker[1] then 
      local x, y, z = getElementPosition ( source ) 
      local rx, ry, rz = getElementRotation ( source ) 
      ramp = createObject ( 1634, x, y, z, rx, ry, rz ) 
      attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 )  
      bindKey ( "mouse2", "down", function ()  moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) end) 
            end 
        end 
    end 
) 

Sorry For Delay Castillo.I Test Tnx.

Link to comment

Without attachElements.

Example (Raw)

  
       local x, y, z = getElementPosition ( source ) 
       local rx, ry, rz = getElementRotation ( source ) 
       local X, Y, Z = getElementPosition ( source ) 
       local omg = ramp+moved 
       ramp = createObject ( 1634, x, y + 6, z -1, rx, ry, rz + 180) 
       moved = moveObject ( ramp, 100, X + 3, Y, Z)  
       bindKey ( "mouse2", "down", omg )  

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