Jump to content

Moving Gate Script


donis123

Recommended Posts

Posted

Hey! :) i wanna know more about moving gate script couz i ahve find some format there i set in my gate pos and all that stuff and try make a Meta but im not sure about how do i do a Meta to moving gates so here is a " list " off what i wanna know and maby you can make the formats to me and write something about how i do it? :)

Do i need Meta? (and if how do i set it up can you do it for me and show me?)

do the Meta do something that the Lua will not start or show some error when i start the (MTA server)?

can you make a good and easy Moving Gate format to me so i can follow it and make my gate and make sure you write info about how to do it couz i dont know so much about it!

ps: dont tell me to look at the forum couz i have been looking everywhere and try all Lua formats and nothing works! pleas take a time of you life to help me with this, this is my dream to start up a server i have just started all this stuff now and will be happy for one who can help me on the way up to a server! :) thanks aigen to all who help! ^^ btw if you dont have made one before and dont know that works pleas dont post it here ;/ i looking for one who know the Meta and Lua works couz i have used over 20 hours of my life to look and try and fail and yeah try make the moving gate and now im just tired and realy take this as my last opportunity to make it so aigen i will be very happy for some help! :) and when i say that i have used 20 hours then i mean it to :P Have a nice day :D

Posted

STAFF EDIT/NOTE: Easiest is just downloading this ready to go Moving gates script: https://community.multitheftauto.com/?p=resources&s=details&id=14987

Of course you need meta you always need a meta file for a new resource.

The meta.xml should look something like this:

  "Your_Name" name="resource_name" version="1.0" type="script"/> 
   
  
 

Then the "move_gate.lua"

--create the gate 
local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) 
local state = 0     --this is the state, if 0 gate closed if 1 it's open 
  
function move() 
    if state == 0 then                       --it's closed so open it 
        moveObject ( gate, Time, New_X, New_Y, New_Z)  --Time means how fast the object'ill be moved. 
        state = state + 1 
    elseif state == 1 then                 --it's open so close it 
        moveObject ( gate, Time,Old_X, Old_Y, Old_Z) 
        state = state - 1 
    end 
end 
 addCommandHandler("gate", move )--this one creates a command "/gate" wich'll start the move function  
 

This script is written by xScatta and also can be found in the forum here:

https://forum.multitheftauto.com/viewtopic.php?f=91&t=63339&p=602320#p602320

and you should also start reading the wiki page because you can find all these stuff there.

Posted
Of course you need meta you always need a meta file for a new resource.

The meta.xml should look something like this:

  "Your_Name" name="resource_name" version="1.0" type="script"/> 
   
  

Then the "move_gate.lua"

--create the gate 
local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) 
local state = 0     --this is the state, if 0 gate closed if 1 it's open 
  
function move() 
    if state == 0 then                       --it's closed so open it 
        moveObject ( gate, Time, New_X, New_Y, New_Z)  --Time means how fast the object'ill be moved. 
        state = state + 1 
    elseif state == 1 then                 --it's open so close it 
        moveObject ( gate, Time,Old_X, Old_Y, Old_Z) 
        state = state - 1 
    end 
end 
 addCommandHandler("gate", move )--this one creates a command "/gate" wich'll start the move function  

This script is written by xScatta and also can be found in the forum here:

https://forum.multitheftauto.com/viewtopic.php?f=91&t=63339&p=602320#p602320

and you should also start reading the wiki page because you can find all these stuff there.

Thank you so much for help! :D

Posted
Of course you need meta you always need a meta file for a new resource.

The meta.xml should look something like this:

  "Your_Name" name="resource_name" version="1.0" type="script"/> 
   
  

Then the "move_gate.lua"

--create the gate 
local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) 
local state = 0     --this is the state, if 0 gate closed if 1 it's open 
  
function move() 
    if state == 0 then                       --it's closed so open it 
        moveObject ( gate, Time, New_X, New_Y, New_Z)  --Time means how fast the object'ill be moved. 
        state = state + 1 
    elseif state == 1 then                 --it's open so close it 
        moveObject ( gate, Time,Old_X, Old_Y, Old_Z) 
        state = state - 1 
    end 
end 
 addCommandHandler("gate", move )--this one creates a command "/gate" wich'll start the move function  

This script is written by xScatta and also can be found in the forum here:

https://forum.multitheftauto.com/viewtopic.php?f=91&t=63339&p=602320#p602320

and you should also start reading the wiki page because you can find all these stuff there.

hmm get an error " couldnt find the Move.gate.lua "

--create the gate 
local AdminGate = createObject ( 971, -504.7998046875, 2592.599609375, 56.200000762939, 0, 0, 90 ) 
local state = 0     --this is the state, if 0 gate closed if 1 it's open 
  
function move() 
    if state == 0 then                       --it's closed so open it 
        moveObject ( AdminGate, 2500, -504.79998779297, 2592.6000976563, 62.099998474121)  --Time means how fast the object'ill be moved. 
        state = state + 1 
    elseif state == 1 then                 --it's open so close it 
        moveObject ( AdminGate, 2500, -504.7998046875, 2592.599609375, 56.200000762939,) 
        state = state - 1 
    end 
end 
 addCommandHandler("admin75", move )--this one creates a command "/gate" wich'll start the move function 

and the meta

<meta> 
  <info author="Don" name="AdminGate" version="1.0" type="script"/> 
  
  <script src="move_gate.lua" type="server"/> 
  
 </meta> 

what is the problem here? ;(

Posted

Lua is case sensitive so maybe it's because the big M, but maybe because there is a "." and not a "_" int the move_gate.lua

try using something easier, simpler name like gate.lua and also dont forget to change the name in the meta

Posted
Lua is case sensitive so maybe it's because the big M, but maybe because there is a "." and not a "_" int the move_gate.lua

try using something easier, simpler name like gate.lua and also dont forget to change the name in the meta

okay man i try do that! :) thanks for your help if it dont work i will tell you! ^^

Posted
any error message?

haha i find out how to fix it now is works! :D thanks man! :D thanks for use your time to help me very happy now! ^^ i did just have to copy the text inside Lua and make a new Lua save file and paste the text with the name in Meta! :D

Posted
any error message?

the gate wont open ;/ i use the command but still nothing can you take a look on the lua i posted upstairs on the site and see for any problems?

Posted

The problem is in here:

moveObject ( AdminGate, 2500, -504.7998046875, 2592.599609375, 56.200000762939,) 

You dont need that comma in the end of the line

Posted
The problem is in here:
moveObject ( AdminGate, 2500, -504.7998046875, 2592.599609375, 56.200000762939,) 

You dont need that comma in the end of the line

hmm okay but now its works but its a double gate now! X) hehe

Posted (edited)
if AdminGate then  destroyElement ( AdminGate ) end 
local AdminGate = createObject ( 971, -504.7998046875, 2592.599609375, 56.200000762939, 0, 0, 90 ) 
local state = 0     --this is the state, if 0 gate closed if 1 it's open 
  
function move() 
    if state == 0 then                       --it's closed so open it 
        moveObject ( AdminGate, 2500, -504.79998779297, 2592.6000976563, 62.099998474121)  --Time means how fast the object'ill be moved. 
        state = state + 1 
    elseif state == 1 then                 --it's open so close it 
        moveObject ( AdminGate, 2500, -504.7998046875, 2592.599609375, 56.200000762939) 
        state = state - 1 
    end 
end 
 addCommandHandler("admin75", move )--this one creates a command "/gate" wich'll start the move function 

Edited by Guest
  • 1 month later...
Posted

I want when approaching the gate to open, and when I go to close.........And for all players I want to open the gate(Automatic)without I press a command...

can someone help me????

more detail????

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