DarkLink Posted June 16, 2011 Share Posted June 16, 2011 Guys I need ur help, i made these like someone said me a few days ago using getElementByID, but is not working. 1º I have one resource called "olamundo" in that resource (i mean, in that folder), i have .map file and meta.xml file and .lua file. i have this one .map file: <map edf:definitions="ctf,editor_main"> <marker id="marker (cylinder) (1)" type="cylinder" color="#0000ff99" size="2" interior="0" dimension="0" posX="770.58630371094" posY="1668.0819091797" posZ="4.1890187263489" rotX="0" rotY="0" rotZ="0" /> <marker id="marker (cylinder) (2)" type="cylinder" color="#0000ff99" size="1" interior="0" dimension="0" posX="796.76818847656" posY="1668.2836914063" posZ="6.8681697845459" rotX="0" rotY="0" rotZ="0" /> </map> these on meta: <meta> <info author="dont want u to read :b" version="0.1" type="gamemode" name="DarkLink" description="testing" /> <script src="Untitled 3.lua" type="server" /> <map src="teleporte.map" dimension="0" /> </meta> and on .lua file: markerofcol = getElementByID("marker1") q,w,e = getElementPosition(markerofcol) marker2 = getElementByID("marker2") function teleporte (player) local x,y,z = getElementPosition(marker2) setElementPosition(player, x, y, z) end addEventHandler("onMarkerHit", markerofcol, teleporte) And I have these errors on console when I run the resource olamundo: First Error: bad argument at 'getElementPosition' Second Error: bad argument at 'addEventHandler' So can u guys explain me what I am doing wrong? thanks alot again Link to comment
UAEpro Posted June 16, 2011 Share Posted June 16, 2011 because the id is marker (cylinder) (1) not marker1 Link to comment
DarkLink Posted June 16, 2011 Author Share Posted June 16, 2011 LOOOL GUYS, i forgot to replace the name in .map file --« I AM THE BIIGGEST LOSER LULZ Thanks alot UAE ;D Link to comment
DarkLink Posted June 16, 2011 Author Share Posted June 16, 2011 By the way guys, is there anyway to make a little delay before the player get teleported ? without the setTimer ? because if I use a setTimer I have a code more complex with two functions.. like these: function eventTrigger (player) thePlayer = player setTimer(teleport, 1000, 1) end addEventHandler("onMarkerHit", markerofcol, teleporte) function teleport () local x,y,z = getElementPosition(marker2) setElementPosition(thePlayer, x, y, z) end so there is a better way and with less code to make a delay? thanks! Link to comment
JR10 Posted June 16, 2011 Share Posted June 16, 2011 function teleport (player) local x,y,z = getElementPosition(marker2) setTimer(setElementPosition, 1000, 1, player, x, y, z) end addEventHandler("onMarkerHit", markerofcol, teleport ) Link to comment
DarkLink Posted June 16, 2011 Author Share Posted June 16, 2011 Ahhh didnt know i could do that ! I though that was only with separated functions thanks alot bro ;D 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