Jump to content

Gatemove


Fox261098

Recommended Posts

This good ?

function (createTheMarker) 
    createMarker (x,y,z) 
end 
  
function (createObject) 
    createObject (x,y,z) 
end 
  
function (moveObject) 
    moveObject (x,y,z) 
end 
onMarkerHit ( thePlayer ) objectMove 
  
function (moveObjectBack) 
    moveObjectBack (x,y,z) 
end 
onMarkerHit ( thePlayer ) objectMoveBack 

Link to comment

onMarkerHit is an event which is used in an addEventHandler,

First you write the event name, then the marker name, then the function name

mx, my, mz are marker coordinates

r, g, b, a (red, green, blue, alpha (alpha is visibility))

x, y, z closed gate coordinates

rx, ry, rz rotation of the gate

timeInMillisec needs to be a time in milliseconds (1000ms is 1 sec)

x2, y2, z2 location of the gate after moving.

  
local markerName = createMarker(mx, my, mz, "cylinder", 1.0, r, g, b, 255) 
local gateName = createObject(model, x, y, z, rx, ry, rz) 
  
function markerHitFunction() 
 moveObject(gateName, timeInMillisec, x2, y2, z2) 
end 
  
addEventHandler("onMarkerHit", markerName, markerHitFunction 

The gate will only open now not close.

Understand this and we'll continue

Link to comment

local markerName = createMarker(mx, my, mz, "cylinder", 1.0, r, g, b, 255)

local gateName = createObject(model, x, y, z, rx, ry, rz) this too tx ry rz ???

function markerHitFunction()

moveObject(gateName, timeInMillisec, x2, y2, z2) what means y2 y2 z2?

end

addEventHandler("onMarkerHit", markerName, markerHitFunction

Link to comment

mx, my, mz are marker coordinates

r, g, b, a (red, green, blue, alpha (alpha is visibility))

x, y, z closed gate coordinates

rx, ry, rz rotation of the gate

timeInMillisec needs to be a time in milliseconds (1000ms is 1 sec)

x2, y2, z2 location of the gate after moving.

I've explained it here, look above. Also try using the LUA tags in the forum.

Link to comment

How I like to work is with a state boolean there are other ways tho.

local state = false 
  
function markerHitFunction() 
 if (state) then 
  moveGate = moveObject(gateName, timeInMillisec, x2, y2, z2) 
 else 
  moveGate = moveObject(gateName, timeInMillisec, x, y, z) -- Original x, y, z coordinates 
 end 
 if (moveGate) then 
  state = not state; 
 end 
end 

Didn't test I'm in class atm probably should work.

Link to comment

i need other part of this to close the gate

local markerName = createMarker(mx, my, mz, "cylinder", 1.0, r, g, b, 255) 
local gateName = createObject(model, x, y, z, rx, ry, rz) 
  
function markerHitFunction() 
 moveObject(gateName, 2000, x, y, z) 
end 
  
addEventHandler("onMarkerHit", markerName, markerHitFunction) 

and can u make it and put the command just for one gang to use gang name TheGhosts

Link to comment
local markerName = createMarker(mx, my, mz, "cylinder", 1.0, r, g, b, 255) 
local gateName = createObject(model, x, y, z, rx, ry, rz) 
local state = false 
  
function markerHitFunction() 
 if (state) then 
  moveGate = moveObject(gateName, timeInMillisec, x2, y2, z2) 
 else 
  moveGate = moveObject(gateName, timeInMillisec, x, y, z) -- Original x, y, z coordinates 
 end 
 if (moveGate) then 
  state = not state; 
 end 
end 
      
addEventHandler("onMarkerHit", markerName, markerHitFunction) 

You just needed to fill it in the part you had, I suggest you learning LUA first cause all I did was make it for you.

https://wiki.multitheftauto.com/wiki/Sc ... troduction

Don't start with moving gates, start easy, outputs, set money, etc.

Kind regards,

Billy

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