Jump to content

.


Gravestone

Recommended Posts

Try this

https://forum.multitheftauto.com/viewtopic.php?f ... al#p835536

Dont forget to make yourself as manager by adding your account name in it.

@BluntZ , it's a tool script to create gates automaticly, but he want to learn how to create it by scripting.

Hello, to make a gate moving or openning, you need to use the main function is moveObject, click on the function to know more about it

All the functions that you need to make a gate moving

--Functions: 
createObject 
moveObject 
createMarker 
setTimer 
--or you can use it with colShape  
createColCircle 
--Events: 
onMarkerHit 
onMarkerLeave 
--copShape events: 
onColShapeHit 
onColShapeLeave 
  

Now you know which functions you need to do that, let's make a simple example to open a gate with marker

local aGate = createObject( id, x, y, z ) -- creating the gate and defining it 
setElementRotation ( aGate , rx, ry, rz ) -- setting the rotation of the object that we created 
local theMarker = createMarker(x, y, z, "cylinder", 4,255,255,255,0) --we create our marker and set the alpha of it to 0 
  
function openGate() 
        moveObject ( aGate , speed, x, y, z )   
end 
addEventHandler( "onMarkerHit", theMarker, openGate) 
  
function closeGate() 
       moveObject (aGate , speed, x, y, z)    
end 
addEventHandler( "onMarkerLeave", theMarker, closeGate) 
  

Link to comment
Try this

https://forum.multitheftauto.com/viewtopic.php?f ... al#p835536

Dont forget to make yourself as manager by adding your account name in it.

@BluntZ , it's a tool script to create gates automaticly, but he want to learn how to create it by scripting.

Hello, to make a gate moving or openning, you need to use the main function is moveObject, click on the function to know more about it

All the functions that you need to make a gate moving

--Functions: 
createObject 
moveObject 
createMarker 
setTimer 
--or you can use it with colShape  
createColCircle 
--Events: 
onMarkerHit 
onMarkerLeave 
--copShape events: 
onColShapeHit 
onColShapeLeave 
  

Now you know which functions you need to do that, let's make a simple example to open a gate with marker

local aGate = createObject( id, x, y, z ) -- creating the gate and defining it 
setElementRotation ( aGate , rx, ry, rz ) -- setting the rotation of the object that we created 
local theMarker = createMarker(x, y, z, "cylinder", 4,255,255,255,0) --we create our marker and set the alpha of it to 0 
  
function openGate() 
        moveObject ( aGate , speed, x, y, z )   
end 
addEventHandler( "onMarkerHit", theMarker, openGate) 
  
function closeGate() 
       moveObject (aGate , speed, x, y, z)    
end 
addEventHandler( "onMarkerLeave", theMarker, closeGate) 
  

Oh okay ! , You can use GTWGates script from GTW game mod.

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