Jump to content

Help dont work


manve1

Recommended Posts

Posted

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

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted
  
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

Posted

it wont work... its same thing.. nothing is changed, everything is the same writen, i missed out a part which i dont know about it. But still thx for a try

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted
addEventHandler("onColShapeHit", gate, hit) 

Here, you are attaching the event to the object, not to the colshape, it should be:

addEventHandler("onColShapeHit", col, hit) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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