NotAvailable Posted April 23, 2010 Share Posted April 23, 2010 Hi, i made an base with some gates ofcourse. And i got the MTASA script program but i need the Script for the moving gates i got the X Y Z coordinates already of the gates I only need the code. Does someone know it. I would really appreciate that. Link to comment
karlis Posted April 23, 2010 Share Posted April 23, 2010 https://community.multitheftauto.com/index.php?p= ... ils&id=614 Link to comment
Taalasmaa Posted April 23, 2010 Share Posted April 23, 2010 You want it to open with a command or with a marker hit? Link to comment
NotAvailable Posted April 23, 2010 Author Share Posted April 23, 2010 You want it to open with a command or with a marker hit? Command like: /openmodgate Link to comment
Taalasmaa Posted April 23, 2010 Share Posted April 23, 2010 function createTheGate () myGate = createObject ( MyObjectID, myGateX, MyGateY, MyGateZ ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, NEWX, NEWY, NEWZ ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 3000, myGateX, MyGateY, MyGateZ ) end Here, this should work. put to myGateX,myGateY,MyGateZ Your gate coords. and to newX,newY,newZ your gate position what it should be when it is open. Regards Taalasmaa Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 function createTheGate () myGate = createObject ( MyObjectID, myGateX, MyGateY, MyGateZ ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, NEWX, NEWY, NEWZ ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 3000, myGateX, MyGateY, MyGateZ ) end Here, this should work. put to myGateX,myGateY,MyGateZ Your gate coords. and to newX,newY,newZ your gate position what it should be when it is open. Regards Taalasmaa didnt work this is what i did: function createTheGate () myGate = createObject ( MyObjectID, 2490.4057617188, 1055.2071533203,58.293659210205 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, 2490.1667480469, 1056.8166503906, 58.293659210205 ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 3000, 2490.4140625, 1055.1296386719, 58.293659210205 ) end Link to comment
Mr.Hankey Posted April 24, 2010 Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. oh thanks Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move? Heres the code: function createTheGate () myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 ) end Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move? Heres the code: function createTheGate () myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 ) end WTF? object (airportgate) (1) this is far away from ID! You need to put object ID into it EXAMPLE: <object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 -- That is the ID! So it should be like myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID -- If i use object id 988 you can change that 988 to your own ID -- Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move? Heres the code: function createTheGate () myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 ) end WTF? object (airportgate) (1) this is far away from ID! You need to put object ID into it EXAMPLE: <object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 -- That is the ID! So it should be like myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID -- If i use object id 988 you can change that 988 to your own ID -- thankyou man im new to scripting Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object. hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move? Heres the code: function createTheGate () myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 ) setTimer ( movingMyGateBack, 5000, 1 ) end addCommandHandler("openmodgate",openMyGate) function movingMyGateBack () moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 ) end WTF? object (airportgate) (1) this is far away from ID! You need to put object ID into it EXAMPLE: <object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 -- That is the ID! So it should be like myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID -- If i use object id 988 you can change that 988 to your own ID -- when i make a moving gate the rotation is the default one. you know how to fix the rotation. Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 when i make a moving gate the rotation is the default one. you know how to fix the rotation. create myGate = createObject(myID, 1485.0126953125, -2474.8330078125, 15.328079223633, 0, 0, myROTATION) Link to comment
NotAvailable Posted April 24, 2010 Author Share Posted April 24, 2010 when i make a moving gate the rotation is the default one. you know how to fix the rotation. create myGate = createObject(myID, 1485.0126953125, -2474.8330078125, 15.328079223633, 0, 0, myROTATION) thanks! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now