AG Adam Posted September 27, 2010 Posted September 27, 2010 Hello, i have a problem. Start with, i suck at scripting, but i want to do this. This should be an elevator (lift). Code: addEventHandler("onPlayerJoin",getRootElement(), function () lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) end function liftfel (hitPlayer,matchingDimension)) local skin = getElementModel (hitPlayer) if skin == 0 or skin == 285 then moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) else killPed (hitPlayer) end addEventHandler ('onMarkerHit', liftmarkerje, liftfel) function liftle (hitPlayer,matchingDimension) moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) end addEventHandler ("onMarkerLeave",liftmarkerje, liftle) end Errors/warnings: [2010-09-27 15:53:38] SCRIPT ERROR: playmap2\server.lua:7: ')' expected (to close '(' at line 1) near 'function' [2010-09-27 15:53:38] WARNING: Loading script failed: playmap2\server.lua:7: ')' expected (to close '(' at line 1) near 'function' Please help me! Scripting for free and for money
Castillo Posted September 27, 2010 Posted September 27, 2010 well, the event must go after function not in function body, and also got a question, why you do onPlayerJoin make the object? addEventHandler("onPlayerJoin",getRootElement(), function () lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) end) function liftfel (hitPlayer,matchingDimension)) local skin = getElementModel (hitPlayer) if skin == 0 or skin == 285 then moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) else killPed (hitPlayer) end end addEventHandler ('onMarkerHit', liftmarkerje, liftfel) function liftle (hitPlayer,matchingDimension) moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) end addEventHandler ("onMarkerLeave",liftmarkerje, liftle) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
AG Adam Posted September 27, 2010 Author Posted September 27, 2010 Thanks, really, i just copied, but i will use onResourceStart (correct me if im noob). Very thanks. Stryp aka Adam Scripting for free and for money
Castillo Posted September 27, 2010 Posted September 27, 2010 Thanks, really, i just copied, but i will use onResourceStart (correct me if im noob).Very thanks. Stryp aka Adam dunno if its needed to put the object into a function, i ever made it without function San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
50p Posted September 27, 2010 Posted September 27, 2010 If the object needs to exist at its place all the time then use map files instead. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
AG Adam Posted September 27, 2010 Author Posted September 27, 2010 [2010-09-27 16:26:25] SCRIPT ERROR: playmap2\server.lua:7: unexpected symbol near ')' [2010-09-27 16:26:25] WARNING: Loading script failed: playmap2\server.lua:7: unexpected symbol near ')' using your script. EDIT: With OnPlayerJoin. Scripting for free and for money
Castillo Posted September 27, 2010 Posted September 27, 2010 [2010-09-27 16:26:25] SCRIPT ERROR: playmap2\server.lua:7: unexpected symbol near ')'[2010-09-27 16:26:25] WARNING: Loading script failed: playmap2\server.lua:7: unexpected symbol near ')' using your script. EDIT: With OnPlayerJoin. addEventHandler("onPlayerJoin",getRootElement(), function () lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) end) function liftfel (hitPlayer,matchingDimension) local skin = getElementModel (hitPlayer) if skin == 0 or skin == 285 then moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) else killPed (hitPlayer) end end addEventHandler ('onMarkerHit', liftmarkerje, liftfel) function liftle (hitPlayer,matchingDimension) moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) end addEventHandler ("onMarkerLeave",liftmarkerje, liftle) you put wrong syntax at function. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted September 27, 2010 Posted September 27, 2010 SCRIPT ERROR: playmap2\server.lua:7: unexpected symbol near ')' Maybe start to think by yourself? You didn't even check that freaking like 7, did you? function liftfel (hitPlayer,matchingDimension)) It's perfectly clear to see what is wrong here ;/ Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
AG Adam Posted September 27, 2010 Author Posted September 27, 2010 Bad argument: AddEventHandler (line 15 and 21) 15 addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 21 addEventHandler ("onMarkerLeave",liftmarkerje, liftle) now im totally stuck. And yeah, i didnt checked, but thanks Scripting for free and for money
Castillo Posted September 27, 2010 Posted September 27, 2010 Bad argument: AddEventHandler (line 15 and 21)15 addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 21 addEventHandler ("onMarkerLeave",liftmarkerje, liftle) now im totally stuck. And yeah, i didnt checked, but thanks try this maybe, addEventHandler("onPlayerJoin",getRootElement(), function () lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) addEventHandler ('onMarkerHit', liftmarkerje, liftfel) addEventHandler ("onMarkerLeave",liftmarkerje, liftle) end) function liftfel (hitPlayer,matchingDimension) local skin = getElementModel (hitPlayer) if skin == 0 or skin == 285 then moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) else killPed (hitPlayer) end end function liftle (hitPlayer,matchingDimension) moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
AG Adam Posted September 27, 2010 Author Posted September 27, 2010 attempt to call global CreateObject ( a nil value ) line 2 Scripting for free and for money
AG Adam Posted September 27, 2010 Author Posted September 27, 2010 CreateObject -> createObject OH!!! IT WORKS! THANKS FOR YOUR HELP, AND THANKS FOR OTHERS!!!! Scripting for free and for money
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