Jump to content

Epic Bug moveObject -.-"


HunT

Recommended Posts

Hi . . I always use the same method to move the objects with marker (always :redhotevil: and work)

And now in debugscript 3 - - - - Bad Argument @ "moveObject" - - - - -This is crazy :wink:

local root = getRootElement() 
local this = getThisResource() 
local resourceRoot = getResourceRootElement(this) 
local localPlayer = getLocalPlayer() 
local Marker = {} 
  
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
    local st3reotxd1 = engineLoadTXD("st3reo3458.txd")  
    engineImportTXD( st3reotxd1, 3458 ) 
     
    local st3reotxd2 = engineLoadTXD("st3reo8838.txd")  
    engineImportTXD( st3reotxd2, 8838 ) 
     
    local st3reotxd3 = engineLoadTXD("st3reo5848.txd")  
    engineImportTXD( st3reotxd3, 5848 ) 
     
        Marker[1] = createMarker(5137.5, -57.07, 1.2, "corona", 5, 0, 0, 0) 
                 
        local object1 = createObject ( 3458, 5137.5068359375, -54.855049133301, -1.2999992370605, 0, 0, 90 ) 
         
        setWeather(0) 
        setSkyGradient() 
        setCloudsEnabled ( false )  
    end 
) 
  
addEventHandler("onClientResourceStop", root, 
    function(res) 
        if res == this then 
             
             
     
    setWeather (0) 
    setWaveHeight ( 0 )  
    setSkyGradient( 0, 0, 0, 0, 0, 0) 
     
    setCloudsEnabled ( false )  
        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 
            moveObject ( object1, 3000, 5137.5068359375, 146.6568145752, -1.2999992370605) 
                 
            end 
        end 
    end 
) 
  
  

The Problem ? (idk :| )

Tnx

Link to comment

Not a bug.

local variables exists only inside the block (function or w/e it's in)

So here:

local root = getRootElement() 
local this = getThisResource() 
local resourceRoot = getResourceRootElement(this) 
local localPlayer = getLocalPlayer() 
local Marker = {} 
  
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
    local st3reotxd1 = engineLoadTXD("st3reo3458.txd") 
    engineImportTXD( st3reotxd1, 3458 ) 
    
    local st3reotxd2 = engineLoadTXD("st3reo8838.txd") 
    engineImportTXD( st3reotxd2, 8838 ) 
    
    local st3reotxd3 = engineLoadTXD("st3reo5848.txd") 
    engineImportTXD( st3reotxd3, 5848 ) 
    
        Marker[1] = createMarker(5137.5, -57.07, 1.2, "corona", 5, 0, 0, 0) 
                
        object1 = createObject ( 3458, 5137.5068359375, -54.855049133301, -1.2999992370605, 0, 0, 90 ) 
        
        setWeather(0) 
        setSkyGradient() 
        setCloudsEnabled ( false ) 
    end 
) 
  
addEventHandler("onClientResourceStop", resourceRoot, 
    function(res) 
  
    setWeather (0) 
    setWaveHeight ( 0 )  
    setSkyGradient( 0, 0, 0, 0, 0, 0) 
    
    setCloudsEnabled ( false ) 
        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 
            moveObject ( object1, 3000, 5137.5068359375, 146.6568145752, -1.2999992370605) 
                
            end 
        end 
    end 
) 
  

Link to comment

local makes the variable exist only in it's block.

So in this case object1 will exist only in:

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
    local st3reotxd1 = engineLoadTXD("st3reo3458.txd") 
    engineImportTXD( st3reotxd1, 3458 ) 
    
    local st3reotxd2 = engineLoadTXD("st3reo8838.txd") 
    engineImportTXD( st3reotxd2, 8838 ) 
    
    local st3reotxd3 = engineLoadTXD("st3reo5848.txd") 
    engineImportTXD( st3reotxd3, 5848 ) 
    
        Marker[1] = createMarker(5137.5, -57.07, 1.2, "corona", 5, 0, 0, 0) 
                
        local object1 = createObject ( 3458, 5137.5068359375, -54.855049133301, -1.2999992370605, 0, 0, 90 ) 
        
        setWeather(0) 
        setSkyGradient() 
        setCloudsEnabled ( false ) 
    end 
) 

So you must make it global to use it anywhere outside the code above.

Link to comment

moveObject is OK Now.

i Have other problem with "setVehicleGravityPoint"

debugscript 3 : attempt to call global "setVehicleGravityPoint" (a nil value) :| (wtf)

-----------------------------------------

Fix with setVehicleGravity -.-"

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