[STM]Metalhero Posted March 30, 2010 Posted March 30, 2010 (edited) I have problem with my script it doesn't work.. It doesn't start when I try to run it I don't know why... Here is my code: <map edf:definitions="race,editor_main"> <object id="object (vgncarshade1) (1)" model="3458" interior="0" dimension="0" posX="3035.4877929688" posY="-1763.1368408203" posZ="0" rotX="0" rotY="0" rotZ="0" /> <object id="object (vgncarshade1) (2)" model="3458" interior="0" dimension="0" posX="3035.494140625" posY="-1768.138671875" posZ="0" rotX="0" rotY="0" rotZ="0" /> <object id="object (vgncarshade1) (3)" model="3458" interior="0" dimension="0" posX="3035.5051269531" posY="-1758.0604248047" posZ="0" rotX="0" rotY="0" rotZ="0" /> <object id="object (vgncarshade1) (4)" model="3458" interior="0" dimension="0" posX="3035.4719238281" posY="-1773.2398681641" posZ="0" rotX="0" rotY="0" rotZ="0" /> <object id="object (vgncarshade1) (5)" model="3458" interior="0" dimension="0" posX="3035.5190429688" posY="-1753.1080322266" posZ="0" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (Baggage) (1)" vehicle="485" interior="0" posX="3018.0471191406" posY="-1752.8343505859" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49548339844" /> <spawnpoint id="spawnpoint (Baggage) (2)" vehicle="485" interior="0" posX="3018.0368652344" posY="-1755.4915771484" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (3)" vehicle="485" interior="0" posX="3018.0598144531" posY="-1757.8681640625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (4)" vehicle="485" interior="0" posX="3018.0229492188" posY="-1760.1781005859" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (5)" vehicle="485" interior="0" posX="3018.0634765625" posY="-1762.5014648438" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (6)" vehicle="485" interior="0" posX="3018.0461425781" posY="-1765.1119384766" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (7)" vehicle="485" interior="0" posX="3018.025390625" posY="-1768.2628173828" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (8)" vehicle="485" interior="0" posX="3018.01953125" posY="-1770.6175537109" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (9)" vehicle="485" interior="0" posX="3018.0891113281" posY="-1772.9945068359" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (10)" vehicle="485" interior="0" posX="3021.8991699219" posY="-1773.04296875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (11)" vehicle="485" interior="0" posX="3021.875" posY="-1770.6379394531" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (12)" vehicle="485" interior="0" posX="3021.9138183594" posY="-1768.318359375" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (13)" vehicle="485" interior="0" posX="3021.6276855469" posY="-1765.4926757813" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (14)" vehicle="485" interior="0" posX="3021.6362304688" posY="-1762.5615234375" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (15)" vehicle="485" interior="0" posX="3021.603515625" posY="-1760.1612548828" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (16)" vehicle="485" interior="0" posX="3021.6320800781" posY="-1757.8946533203" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (17)" vehicle="485" interior="0" posX="3021.6350097656" posY="-1755.4479980469" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (18)" vehicle="485" interior="0" posX="3021.6958007813" posY="-1752.8728027344" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (19)" vehicle="485" interior="0" posX="3025.625" posY="-1752.8197021484" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (20)" vehicle="485" interior="0" posX="3025.5307617188" posY="-1755.5765380859" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (21)" vehicle="485" interior="0" posX="3025.5151367188" posY="-1758.0396728516" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (22)" vehicle="485" interior="0" posX="3025.5891113281" posY="-1760.6108398438" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (23)" vehicle="485" interior="0" posX="3025.5908203125" posY="-1762.6103515625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (24)" vehicle="485" interior="0" posX="3025.5939941406" posY="-1765.8603515625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (25)" vehicle="485" interior="0" posX="3025.5961914063" posY="-1768.3603515625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (26)" vehicle="485" interior="0" posX="3025.5979003906" posY="-1770.6103515625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (27)" vehicle="485" interior="0" posX="3025.5998535156" posY="-1772.8603515625" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (28)" vehicle="485" interior="0" posX="3029.849609375" posY="-1772.8582763672" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (29)" vehicle="485" interior="0" posX="3029.84765625" posY="-1770.857421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (30)" vehicle="485" interior="0" posX="3029.8454589844" posY="-1768.607421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (31)" vehicle="485" interior="0" posX="3029.8422851563" posY="-1766.107421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (32)" vehicle="485" interior="0" posX="3029.8386230469" posY="-1762.857421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (33)" vehicle="485" interior="0" posX="3029.8354492188" posY="-1760.357421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (34)" vehicle="485" interior="0" posX="3029.8327636719" posY="-1758.107421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (35)" vehicle="485" interior="0" posX="3029.8298339844" posY="-1755.857421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <spawnpoint id="spawnpoint (Baggage) (36)" vehicle="485" interior="0" posX="3029.826171875" posY="-1752.857421875" posZ="2.1888470649719" rotX="0" rotY="0" rotZ="270.49438476563" /> <object id="elevator" model="8838" interior="0" dimension="0" movTime="5000" movX="3040.4877929688" movY="-1763.1368408203" movZ="13" moving="true" posX="3040.4877929688" posY="-1770.1368408203" posZ="0" rotX="0" rotY="0" rotZ="0" moving="true" movTime="5000" movX="3040.4877929688" movY="-1770.1368408203" movZ="20" /> </map> Edited March 30, 2010 by Guest
Gamesnert Posted March 30, 2010 Posted March 30, 2010 Please update your post with the guidelines listed in the Proper way of asking questions topic.
KWKSND Posted March 30, 2010 Posted March 30, 2010 Fisrt off you will need to learn to script a bit to do what you want look here https://wiki.multitheftauto.com/index.php?title=Main_Page line 43 of your map 43. you need to do this in a script not the map and you do it as described in these wiki pages first you need to use createObject https://wiki.multitheftauto.com/wiki/CreateObject and then use moveObject https://wiki.multitheftauto.com/wiki/MoveObject good luck
[STM]Metalhero Posted March 30, 2010 Author Posted March 30, 2010 Fisrt off you will need to learn to script a bit to do what you wantlook here https://wiki.multitheftauto.com/index.php?title=Main_Page line 43 of your map 43. you need to do this in a script not the map and you do it as described in these wiki pages first you need to use createObject https://wiki.multitheftauto.com/wiki/CreateObject and then use moveObject thx https://wiki.multitheftauto.com/wiki/MoveObject good luck
[STM]Metalhero Posted March 30, 2010 Author Posted March 30, 2010 now all objects but i want one objects but i want that on object name [move] go up move = getElementsByType ( "object" ) for key, theObject in ipairs ( move ) do local origX, origY, origZ = getElementPosition ( theObject ) local newZ = origZ + 5 moveObject ( theObject, 10, origX, origY, newZ ) end
dzek (varez) Posted March 30, 2010 Posted March 30, 2010 wow, funny.. i've scripted that already, all attributes got same name, and working in the same way (one optional is missing)
[STM]Metalhero Posted March 31, 2010 Author Posted March 31, 2010 wow, funny..i've scripted that already, all attributes got same name, and working in the same way (one optional is missing) and what is the optimal?
dzek (varez) Posted March 31, 2010 Posted March 31, 2010 with getElementsByType getElementData moveObject you can do it if you want to make it elevator like (up and down) use setTimer too
[STM]Metalhero Posted March 31, 2010 Author Posted March 31, 2010 now i write my script but it dont work pls explain me what i moake wrong addEventHandler( "onClientResourceStart", resourceRoot, Client ) function move() move1 = createObject ( 8838, 3057.7666015625, -1763.40625, 0 ) moveIt() end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), move1 ) function moveIt () moveObject ( move1, 3057.7666015625, -1763.40625, 4 ) setTimer ( moveBack, 10000, 4 ) end function moveBack () moveObject ( move1, 3057.7666015625, -1763.40625, 0 ) setTimer (moveIt, 10000, 1 ) end
dzek (varez) Posted March 31, 2010 Posted March 31, 2010 ingame press F8, and type debugscript 3 it will help you. i see you dont see the difference between client and server scripts: any client scripts need to be in sepatare lua file, and in meta.xml there should be "type" attribute set to "client" the line: addEventHandler( "onClientResourceStart", resourceRoot, Client ) no need for it at all. rest of your script looks ok, i've not tested it, but it should work.. if not, use debugscript 3, and see what's wrong ps. please post any lua scripts in [ lua] your code [ /lua] tags
KWKSND Posted April 1, 2010 Posted April 1, 2010 8.addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), move1 ) move1 doesnt exist as a function rename to "move" other than that looks ok i think
[STM]Metalhero Posted April 1, 2010 Author Posted April 1, 2010 there is no mistake in the script but it down work
dzek (varez) Posted April 1, 2010 Posted April 1, 2010 as KWKSND said.. you have wrong name in 8th line.. this should work function move() move1 = createObject ( 8838, 3057.7666015625, -1763.40625, 0 ) moveIt() end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), move ) function moveIt () moveObject ( move1, 3057.7666015625, -1763.40625, 4 ) setTimer ( moveBack, 10000, 4 ) end function moveBack () moveObject ( move1, 3057.7666015625, -1763.40625, 0 ) setTimer (moveIt, 10000, 1 ) end
KWKSND Posted April 1, 2010 Posted April 1, 2010 10.setTimer ( moveBack, 10000, 4 ) should be changed to 10.setTimer ( moveBack, 10000, 1 ) otherwise the timer will repeat 4 times
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