Dimos7 Posted August 28, 2014 Posted August 28, 2014 (edited) Hello i have a problem i try move a object roty and no go there i want i have for 0 and go 90 i put 270 and he go 180 also change and z for 270 to 0 please help <meta> <script src="sfb.lua"/> </meta> local barrier = createObject(968, -1572.1, 658.7, 6.8, 0, 270, 270) state = 0 function open() if state == 0 then setElementRotation( barrier, 0, 0, 270) state = 1 else setElementRotation(barrier, 0, 270, 270) state = 0 end end addCommandHandler("gate", open) Edited August 30, 2014 by Guest
xXMADEXx Posted August 28, 2014 Posted August 28, 2014 Im pretty sure the rotations for the moveObject function are bugged. You can report it here http://bugs.mtasa.com/my_view_page.php
Dimos7 Posted August 29, 2014 Author Posted August 29, 2014 I want learn where to put the getelementposition so opens where is in that locations
Dimos7 Posted August 29, 2014 Author Posted August 29, 2014 (edited) local barrier = createObject(968, -1572.19, 658.79, 6.8, 0, 270, 270) state = 0 function openb(player) if state == 0 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1)then setElementRotation(barrier, 0, 0, 270) state = 1 outputChatBox("opens the barrier.", getPlayerName(player), player, 0, 255, 255) else if state == 1 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1) then setElementRotation(barrier, 0, 270, 270) state = 0 outputChatBox("closes the barrier.", getPlayerName(player), player, 0, 255, 255) end end end addCommandHandler("gate",openb) getElementPossition a nill value getLocalPlayer a nil lvalue Edited August 30, 2014 by Guest
justn Posted August 29, 2014 Posted August 29, 2014 First change: getElementPossition to getElementPosition and are you trying to make this client-sided or server-sided ? because getLocalPlayer is a client-sided function only and 'player' was not defined anywhere in your script.
Dimos7 Posted August 29, 2014 Author Posted August 29, 2014 well i had tried and with source with is server side didnt work i want server side
justn Posted August 30, 2014 Posted August 30, 2014 There you go local barrier = createObject(968, -1572.19, 658.79, 6.8, 0, 270, 270) local state = 0 function openb(player) if state == 0 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1)then setElementRotation(barrier, 0, 0, 270) state = 1 outputChatBox("opens the barrier.",player, 0, 255, 255) elseif state == 1 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1) then setElementRotation(barrier, 0, 270, 270) state = 0 outputChatBox("closes the barrier.", player, 0, 255, 255) end end addCommandHandler("gate",openb) Also you made some simple errors in the script I suggest you visit the wiki to improve your scripting
Dimos7 Posted August 30, 2014 Author Posted August 30, 2014 local barrier = createObject(968, -1572.19, 658.79, 6.8, 0, 270, 270) state = 0 function openb(player) if state == 0 and getElementPosition(player, -1562.9, 661.9, 7) or getElementPosition(player, -1579.3, 661, 7.1) then setElementRotation(barrier, 0, 0, 270) state = 1 outputChatBox("opens the barrier.", player, 0, 255, 255) else setElementRotation(barrier, 0, 270, 270) state = 0 outputChatBox("closes the barrier.", player, 0, 255, 255) end end addCommandHandler("gate",openb) not work only the first if work the else part no work also open even it not in position i put
Et-win Posted September 1, 2014 Posted September 1, 2014 ... You know 'getElementPosition' only has 1 argument, called the element? How could you ever, ever, ever throw those positions into it... If I was you, I should create a marker or a collshape. As soon as the player hits it (onPlayerMarkerHit/onClientMarkerHit/onElementColShapeHit/onClientElementColShapeHit) open or close it. (Could be done with onPlayerMarkerLeave/onClientMarkerLeave/onElementColShapeLeave/onClientElementColShapeLeave)
Dimos7 Posted September 2, 2014 Author Posted September 2, 2014 I want when player be in that position to open or close the with marker etc
Et-win Posted September 2, 2014 Posted September 2, 2014 Well... use something like: local x, y, z = getElementPosition(player) if ((x >= your-x-pos and x <= your-other-x-pos) and (etc...)) So hard isn't it to fill in some variables and check or the player is between the positions you want...
Dimos7 Posted September 6, 2014 Author Posted September 6, 2014 local barrier = createObject(968, -1572.19, 658.79, 6.8, 0, 270, 270) state = 0 function open(player) local x,y,z = getElementPosition(player) if state == 0 and (x >=-1562.9 and x <= -1579.3) and (y >= 661.9 and y <=661) and (z >= 7.1 and z <=7)then setElementRotation(barrier, 0, 0, 270) state = 1 outputChatBox("opens the barrier.", player, 0, 255, 255) else setElementRotation(barrier, 0, 270, 270) state = 0 outputChatBox("closes the barrier.", player, 0, 255, 255) end end addCommandHandler("gate",open) no move the object only apreas the second message http://i.imgur.com/vOzh8AU.png
Dimos7 Posted September 10, 2014 Author Posted September 10, 2014 i need your help idk why i am at position i have put but not working please help local barrier = createObject(968, 1544.6899414063, -1630.8000488281, 13.10000038147, 0, 90, 90) state = 0 function open(player) local x,y,z = getElementPosition(player) if state == 0 and (x >= 1529.63660 and y >= -1628.97876 and z >= 13.38281) and (x <= 1555.20728 and y <= -1627.15662 and z <= 13.38281) then setElementRotation(barrier, 0, 0, 90) state = 1 else if state == 1 and (x >= 1529.63660 and y >= -1628.97876 and z >= 13.38281) and (x <= 1555.20728 and y <= -1627.15662 and z <= 13.38281) then setElementRotation(barrier, 0, 90, 90) state = 0 end end end addCommandHandler("gate", open)
Dimos7 Posted September 11, 2014 Author Posted September 11, 2014 local barrier = createObject(968, 1544.6899414063, -1630.8000488281, 13.10000038147, 0, 90, 90) state = 0 function open(player) local x,y,z = getElementPosition(player) if state == 0 and (x >= 1529.63660 and y >= -1628.97876 and z >= 13.38281) and (x <= 1555.20728 and y <= -1627.15662 and z <= 13.38281) then setElementRotation(barrier, 0, 0, 90) state = 1 else if state == 1 and (x >= 1529.63660 and y >= -1628.97876 and z >= 13.38281) and (x <= 1555.20728 and y <= -1627.15662 and z <= 13.38281) then setElementRotation(barrier, 0, 90, 90) state = 0 end end end addCommandHandler("gate", open) not working i am the position and no do nothing someone help
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