Jump to content

Help dont work


manve1

Recommended Posts

i'm trying to make another script for my server and again it has something wrong with it, debugscript 3 shows no errors, same with console, help me if you can

 gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) 
createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ) 
createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ) 
createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) 
col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) 
  
function hit() 
for key, gate in ipairs ( allObjects ) do 
local origX, origY, origZ = getElementPosition ( gate ) 
moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) 
end 
end 
addEventHandler("onColShapeHit", gate, hit) 
  
function leave() 
moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) 
end 
addEventHandler("onColShapeLeave", gate, leave)  

EDIT: The gate doesnt move when i hit col, or is something wrong with col shape? please help

Link to comment
  
col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) 
gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) 
createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ) 
createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ) 
createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) 
  
  
function hit() 
for key, gate in ipairs ( allObjects ) do 
local origX, origY, origZ = getElementPosition ( gate ) 
moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) 
end 
end 
addEventHandler("onColShapeHit", gate, hit) 
  
function leave() 
moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) 
end 
addEventHandler("onColShapeLeave", gate, leave) 
  

im not sure but try that

Link to comment

That's because "allObjects" table is not defined anywhere.

gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) 
allObjects = 
{ 
    createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ), 
    createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ), 
    createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) 
} 
col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) 
  
function hit() 
    for key, gate in ipairs ( allObjects ) do 
        moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) 
    end 
end 
addEventHandler("onColShapeHit", col, hit) 
  
function leave() 
    moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) 
end 
addEventHandler("onColShapeLeave", col, leave) 

Link to comment

It is moving the objects, but maybe you didn't want to move these, but the fence.

gate = createObject ( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) 
allObjects = 
    { 
        createObject ( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ), 
        createObject ( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ), 
        createObject ( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) 
    } 
col = createColRectangle ( 2773.0812988281, -2422.6938476563, 2.75, 2 ) 
  
function hit ( ) 
    moveObject ( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) 
end 
addEventHandler ( "onColShapeHit", col, hit ) 
  
function leave ( ) 
    moveObject ( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853 ) 
end 
addEventHandler ( "onColShapeLeave", col, leave ) 

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