Jump to content

Doing a Gate Script


Eren97

Recommended Posts

Hey guys.

I am rlly helpless.

I made a Gate with gatemaker and now i have this code

<gate x="277.03125" y="189.408203125" z="1007.171875" rx="0" ry="0" rz="0" x2="280.03125" y2="189.408203125" z2="1007.171875" rx2="0" ry2="0" rz2="0" objectID="974" team="false" collisionx="272.1728515625" collisionY="183.5166015625" collisionZ="1009.171875" collisionSize="10" raising="0" interiorID="3"></gate> 

Where the HELLA fuck to put it in and HOW the hella fuck.

PLEASE help me.

i am rlly new here and to scripting/mapping.

Can i put it in a map too?or a lua script.

how to put it in map,how to put it in lua.

need fast answer pls.

Im very silly about MTA Scripting

Link to comment

Unpack "gatemaker.zip" and open up "gates.xml", then copy your gate code into it.

Like this:

-- gates.xml:

<gates> 
<gate x="277.03125" y="189.408203125" z="1007.171875" rx="0" ry="0" rz="0" x2="280.03125" y2="189.408203125" z2="1007.171875" rx2="0" ry2="0" rz2="0" objectID="974" team="false" collisionx="272.1728515625" collisionY="183.5166015625" collisionZ="1009.171875" collisionSize="10" raising="0" interiorID="3"></gate> 
</gates> 
  

Link to comment

i started gatemaker and did /addgate id and then i placed it and then pressed enter and then placed where it has to move and then enter and then where the collision area has to be...

and then the code were in that file.and NOW what to DO with THAT code???

Link to comment

-- server side:

gateCol = createColTube(275.57169, 190.07436, 1006.17188, 2, 2.5) 
setElementInterior(gateCol, 3) 
gate = createObject(974, 277.03125, 189.408203125, 1007.171875) 
setElementInterior(gate, 3) 
  
addEventHandler("onColShapeHit",gateCol, 
function (hitElement) 
    moveObject(gate, 3000, 280.03125, 189.408203125, 1007.171875) 
    setTimer(moveObject,6000,1,gate,3000,277.03125, 189.408203125, 1007.171875) 
end) 

Link to comment

Create a new resource in your "resources" folder and create two files:

First: script.lua

Then open it and copy this into it:

gateCol = createColTube(275.57169, 190.07436, 1006.17188, 2, 2.5) 
setElementInterior(gateCol, 3) 
gate = createObject(974, 277.03125, 189.408203125, 1007.171875) 
setElementInterior(gate, 3) 
  
addEventHandler("onColShapeHit",gateCol, 
function (hitElement) 
    moveObject(gate, 3000, 280.03125, 189.408203125, 1007.171875) 
    setTimer(moveObject,6000,1,gate,3000,277.03125, 189.408203125, 1007.171875) 
end) 

Save the file and close it.

Second: meta.xml

Then open it and copy this into it:

    

Save the file and close it.

And third (last step): type /refresh in-game (logged in as admin) or refresh in server console, then start the resource.

Link to comment
gateCol = createColCircle(272.1728515625, 183.5166015625, 1009.171875, 10) 
setElementInterior(gateCol, 3) 
gate = createObject(974, 277.03125, 189.408203125, 1007.171875) 
setElementInterior(gate, 3) 
  
addEventHandler("onColShapeHit",gateCol, 
function (hitElement) 
    moveObject(gate, 280.03125, 189.408203125, 1007.171875) 
end) 

'hitElement' was used in moveObject instead of 'gate'.

Link to comment

Yes, sorry, I used the wrong colshape :P.

gateCol = createColTube(275.57169, 190.07436, 1006.17188, 2, 2.5) 
setElementInterior(gateCol, 3) 
gate = createObject(974, 277.03125, 189.408203125, 1007.171875) 
setElementInterior(gate, 3) 
  
addEventHandler("onColShapeHit",gateCol, 
function (hitElement) 
    moveObject(gate, 3000, 280.03125, 189.408203125, 1007.171875) 
    setTimer(moveObject,6000,1,gate,3000,277.03125, 189.408203125, 1007.171875) 
end) 

Now it works.

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