stefutz101 Posted August 2, 2015 Share Posted August 2, 2015 x1=-357.10000610352 y1=1588.0999755859 z1=2683 local x, y, z = getElementPosition(thePlayer) function gotoloja(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja) This work 50% : this script teleport at x1,y1,z1 but dont it don't teleport back at first x y z ...Please help , Thank You a lot ! Link to comment
#Madara Posted August 2, 2015 Share Posted August 2, 2015 debugscript ? and try this : x1=-357.10000610352 y1=1588.0999755859 z1=2683 function gotoloja(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja local x, y, z = getElementPosition(thePlayer) setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja) Link to comment
stefutz101 Posted August 2, 2015 Author Share Posted August 2, 2015 http://iceimg.net/images/2015/08/02/mta ... -27-51.png I can go at x1 , y1,z1 but i cant go back at x y z , the same problem but now i have 1 warning. Ty for try But dont work 100 % Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 x1=-357.10000610352 y1=1588.0999755859 z1=2683 function gotoloja(thePlayer) local x, y, z = getElementPosition(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja) Link to comment
stefutz101 Posted August 2, 2015 Author Share Posted August 2, 2015 I tested already this version when i type first time /loja teleport me at x1 z1 y1 , when i type secound time nothing happen . No errors or warnings . Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 Are you sure you tested it? The code from my post works, unless you have set the script to client side in meta. Link to comment
stefutz101 Posted August 2, 2015 Author Share Posted August 2, 2015 Client side ? Are you sure ?... If i put it in client all pleople what connect on my server can see the script ... Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 No... I'm telling your script works fine as it should. x1=-357.10000610352 y1=1588.0999755859 z1=2683 local x, y, z function gotoloja(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja x, y, z = getElementPosition(thePlayer) setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja) Link to comment
stefutz101 Posted August 2, 2015 Author Share Posted August 2, 2015 x1=-357.10000610352 y1=1588.0999755859 z1=2683 local x, y, z function gotoloja(thePlayer) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Helper" )) then if getElementData(thePlayer, "loja") == false then --check if is in loja x, y, z = getElementPosition(thePlayer) setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end end addCommandHandler("loja",gotoloja) If are up to 2 admins / helpers and they go in "loja" when they type /loja again they will be teleport at where was last person when he go in "loja" . Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 Of course, because it's global. x1=-357.10000610352 y1=1588.0999755859 z1=2683 function gotoloja(thePlayer) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Helper" )) then if getElementData(thePlayer, "loja") == false then --check if is in loja setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true setElementData(thePlayer, "vector", {getElementPosition(thePlayer)}) else local x, y, z = unpack(getElementData(thePlayer, "vector")) setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end end addCommandHandler("loja",gotoloja) Link to comment
stefutz101 Posted August 3, 2015 Author Share Posted August 3, 2015 The same problem ... No errors or warnings 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