Ozen Posted July 29, 2013 Share Posted July 29, 2013 Hello everybody =) 1) sorry for my bad english but i try to do my best. 2) dont take attention abouts french part (im franglais "french/English" in same time, but here i will only speak english) 3) Im a beigner in lua it why they have some (--text) to know what do what) 4) I work with a SQL database for my server so this is my problem i have started a gate script from nothing, this is what he look like at this time : Gate.lua -- Gate By Ozen the gate for admin place -- Gate 1 objecta1 = createObject(980, 480, 2379, 30.5, 0, 0, 158) markera1 = createMarker(480, 2379, 28, "cylinder", 5, 0, 100, 0, 100) function gateoa1 ( theplayer ) -- function name moveObject (objecta1, 3000, 480, 2379, 10.1) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",player,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera1, gateoa1) -- part for close gate function gateca1 ( theplayer ) -- starting closing part of the script moveObject (objecta1, 3000, 480, 2379, 30.5) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera1, gateca1) -- When you leave the zone of the marker the gate will close. -- Gate 2 objecta2 = createObject(980, -46.400001525879, 2322.3000488281, 25, 0, 0, 320) markera2 = createMarker(-46.400001525879, 2322.3000488281, 21, "cylinder", 5, 0, 100, 0, 100) function gateoa2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 10) outputChatBox("Bonne Route",player,255,0,0) end addEventHandler("onMarkerHit", markera2, gateoa2) function gateca2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 25) end addEventHandler("onMarkerLeave", markera2, gateca2) -- Gate 3 objecta3 = createObject(980, -102.19999694824, 2565.1999511719, 19.89999961853, 0, 0, 77) markera3 = createMarker(-102.19999694824, 2565.1999511719, 16, "cylinder", 5, 0, 100, 0, 100) function gateoa3 ( theplayer ) -- function name moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 10) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",player,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera3, gateoa3) -- part for close gate function gateca3 ( theplayer ) -- starting closing part of the script moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 19.89999961853) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera3, gateca3) -- When you leave the zone of the marker the gate will close. -- Mecano Gate objectm = createObject(969, -2863.8000488281, 470.79998779297, 3.7999999523163, 0, 0, 264.5) markerm = createMarker(-2864.26, 466.73, 3.8, "cylinder", 7, 0, 100, 100, 100) function gateom ( theplayer ) -- function name moveObject (objectm, 3000, -2863.8000488281, 470.79998779297, 0) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Mecano",player,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markerm, gateom) -- part for close gate function gatecm ( theplayer ) -- starting closing part of the script moveObject (objectm, 6000, -2863.8000488281, 470.79998779297, 3.7999999523163) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markerm, gatecm) -- When you leave the zone of the marker the gate will close. All work fine but i try to get my faction to open my door i have try this method and ..it not work : Gate1.lua (attemp to get factions of the player line: 7,8,11,12) -- Gate By Ozen the gate for admin place -- Gate 1 objecta1 = createObject(980, 480, 2379, 30.5, 0, 0, 158) markera1 = createMarker(480, 2379, 28, "cylinder", 5, 0, 100, 0, 100) function gateoa1 ( theplayer ) -- function name local data = getElementData(player,"factions") if (data=="Program") then moveObject (objecta1, 3000, 480, 2379, 10.1) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",player,255,0,0) else outputChatBox("Acces Refuse",player,255,0,0) end end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera1, gateoa1) -- part for close gate function gateca1 ( theplayer ) -- starting closing part of the script moveObject (objecta1, 3000, 480, 2379, 30.5) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera1, gateca1) -- When you leave the zone of the marker the gate will close. Aslo i have this method and it wont work too: gate1.lua (attemp to call them to sql)(I have think i have sql ddb so i need to call there but ... not work)(line :7,8,11,12) -- Gate By Ozen the gate for admin place -- Gate 1 objecta1 = createObject(980, 480, 2379, 30.5, 0, 0, 158) markera1 = createMarker(480, 2379, 28, "cylinder", 5, 0, 100, 0, 100) function gateoa1 ( theplayer ) -- function name local data = executeSQLQuery("SELECT `groupID` FROM `mta`, `wcf1_user_to_group`") if (data=="4") then moveObject (objecta1, 3000, 480, 2379, 10.1) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",player,255,0,0) else outputChatBox("Acces Refuse",player,255,0,0) end end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera1, gateoa1) -- part for close gate function gateca1 ( theplayer ) -- starting closing part of the script moveObject (objecta1, 3000, 480, 2379, 30.5) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera1, gateca1) -- When you leave the zone of the marker the gate will close. if somewone can found the problem and help me to find the good way to write them this will be a great helpfull for a beigner thanks alots for futur comment =) Link to comment
manawydan Posted July 30, 2013 Share Posted July 30, 2013 try no tested -- Gate By Ozen the gate for admin place -- Gate 1 local objecta1 = createObject(980, 480, 2379, 30.5, 0, 0, 158) local markera1 = createMarker(480, 2379, 28, "cylinder", 5, 0, 100, 0, 100) function gateoa1 ( theplayer ) -- function name moveObject (objecta1, 3000, 480, 2379, 10.1) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera1, gateoa1) -- part for close gate function gateca1 ( theplayer ) -- starting closing part of the script moveObject (objecta1, 3000, 480, 2379, 30.5) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera1, gateca1) -- When you leave the zone of the marker the gate will close. -- Gate 2 local objecta2 = createObject(980, -46.400001525879, 2322.3000488281, 25, 0, 0, 320) local markera2 = createMarker(-46.400001525879, 2322.3000488281, 21, "cylinder", 5, 0, 100, 0, 100) function gateoa2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 10) outputChatBox("Bonne Route",theplayer,255,0,0) end addEventHandler("onMarkerHit", markera2, gateoa2) function gateca2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 25) end addEventHandler("onMarkerLeave", markera2, gateca2) -- Gate 3 local objecta3 = createObject(980, -102.19999694824, 2565.1999511719, 19.89999961853, 0, 0, 77) local markera3 = createMarker(-102.19999694824, 2565.1999511719, 16, "cylinder", 5, 0, 100, 0, 100) function gateoa3 ( theplayer ) -- function name moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 10) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera3, gateoa3) -- part for close gate function gateca3 ( theplayer ) -- starting closing part of the script moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 19.89999961853) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera3, gateca3) -- When you leave the zone of the marker the gate will close. -- Mecano Gate local objectm = createObject(969, -2863.8000488281, 470.79998779297, 3.7999999523163, 0, 0, 264.5) local markerm = createMarker(-2864.26, 466.73, 3.8, "cylinder", 7, 0, 100, 100, 100) function gateom ( theplayer ) -- function name moveObject (objectm, 3000, -2863.8000488281, 470.79998779297, 0) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Mecano",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markerm, gateom) -- part for close gate function gatecm ( theplayer ) -- starting closing part of the script moveObject (objectm, 6000, -2863.8000488281, 470.79998779297, 3.7999999523163) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markerm, gatecm) -- When you leave the zone of the marker the gate will close. Link to comment
Ozen Posted August 2, 2013 Author Share Posted August 2, 2013 try no tested -- Gate By Ozen the gate for admin place -- Gate 1 local objecta1 = createObject(980, 480, 2379, 30.5, 0, 0, 158) local markera1 = createMarker(480, 2379, 28, "cylinder", 5, 0, 100, 0, 100) function gateoa1 ( theplayer ) -- function name moveObject (objecta1, 3000, 480, 2379, 10.1) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera1, gateoa1) -- part for close gate function gateca1 ( theplayer ) -- starting closing part of the script moveObject (objecta1, 3000, 480, 2379, 30.5) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera1, gateca1) -- When you leave the zone of the marker the gate will close. -- Gate 2 local objecta2 = createObject(980, -46.400001525879, 2322.3000488281, 25, 0, 0, 320) local markera2 = createMarker(-46.400001525879, 2322.3000488281, 21, "cylinder", 5, 0, 100, 0, 100) function gateoa2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 10) outputChatBox("Bonne Route",theplayer,255,0,0) end addEventHandler("onMarkerHit", markera2, gateoa2) function gateca2 ( theplayer ) moveObject (objecta2, 3000, -46.400001525879, 2322.3000488281, 25) end addEventHandler("onMarkerLeave", markera2, gateca2) -- Gate 3 local objecta3 = createObject(980, -102.19999694824, 2565.1999511719, 19.89999961853, 0, 0, 77) local markera3 = createMarker(-102.19999694824, 2565.1999511719, 16, "cylinder", 5, 0, 100, 0, 100) function gateoa3 ( theplayer ) -- function name moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 10) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Bonne Route",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markera3, gateoa3) -- part for close gate function gateca3 ( theplayer ) -- starting closing part of the script moveObject (objecta3, 3000, -102.19999694824, 2565.1999511719, 19.89999961853) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markera3, gateca3) -- When you leave the zone of the marker the gate will close. -- Mecano Gate local objectm = createObject(969, -2863.8000488281, 470.79998779297, 3.7999999523163, 0, 0, 264.5) local markerm = createMarker(-2864.26, 466.73, 3.8, "cylinder", 7, 0, 100, 100, 100) function gateom ( theplayer ) -- function name moveObject (objectm, 3000, -2863.8000488281, 470.79998779297, 0) -- the "500" is the time in milli sec so 500 is 1/2 sec outputChatBox("Mecano",theplayer,255,0,0) end -- fin a cette partie du scripte -- partie pour ouvrire la gate "add the addEventHandler on the Function "onMarkerHit" addEventHandler("onMarkerHit", markerm, gateom) -- part for close gate function gatecm ( theplayer ) -- starting closing part of the script moveObject (objectm, 6000, -2863.8000488281, 470.79998779297, 3.7999999523163) -- define the original place. end -- end script addEventHandler("onMarkerLeave", markerm, gatecm) -- When you leave the zone of the marker the gate will close. Sorry but i dont see any change on your post what is the change and what is do please ? I search to get the ID of my faction (they are in a table on my sql) for allowing the player in the good faction to open and close the gate (also the frist script i have show on my post it the one are work and use on my server but i need to insert something like sqlQuerry but i dont know how to insert this and how to use it) somewone can help me please. Link to comment
Ozen Posted August 4, 2013 Author Share Posted August 4, 2013 150 view and juste 1 comment please make me laugh so any member know how to ? up for last time.. Link to comment
EstrategiaGTA Posted August 4, 2013 Share Posted August 4, 2013 Where is theplayer defined? 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