Azu Posted February 25, 2011 Share Posted February 25, 2011 function GetPosition ( player ) local x, y, z = getElementPosition( player ) outputChatBox("Your Position: "..x..", "..y..", "..z..") end addCommandHandler ( "Postion", GetPosition ) This isn't working. It keeps saying something about an unexpected symbol. What I want to do is get the players position and then have it blow up once is goes past a value in the Y position, like past - 4000 in Y only. Link to comment
norby89 Posted February 25, 2011 Share Posted February 25, 2011 function GetPosition ( player ) local x, y, z = getElementPosition( player ) outputChatBox("Your Position: "..x..", "..y..", "..z) end addCommandHandler ( "Postion", GetPosition ) You added an extra ". You should work in a text editor that supports syntax highlighting, which makes errors like this easier to spot. Link to comment
Moderators Citizen Posted February 25, 2011 Moderators Share Posted February 25, 2011 Hi Azu, If you use notepad++, you would have of to see the extra " ( I can see it in the syntax highlighting of MTA's forum :lol ) You can change the language in notepad++: Language => L => Lua But sometimes I have an error when I start notepad++( Failed to load langs.xml ) and there are no syntax highlighting. To fix it: Go to the installation folder for Notepad++ and delete langs.xml. Then, in that same folder, find langs.model.xml, make a copy of it, and rename the copy to langs.xml. Link to comment
Martyz Posted February 25, 2011 Share Posted February 25, 2011 I didn't test if it works but try it. Put it in server-side script. function resStarts(startedRes) setTimer(check, 1000, 0) end function check() for i, v in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(v) if(y > 4000) then killPed(v) end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resStarts) Link to comment
Castillo Posted February 25, 2011 Share Posted February 25, 2011 What is that this is solved if i'm not wrong. P.S: It's not even what he was doing... Link to comment
proracer Posted February 25, 2011 Share Posted February 25, 2011 As the matter of fact, yes he wanted... look at he's last sentence. Link to comment
Castillo Posted February 25, 2011 Share Posted February 25, 2011 Oh well, my bad i didn't read that. Link to comment
Moderators Citizen Posted February 26, 2011 Moderators Share Posted February 26, 2011 I didn't test if it works but try it. Put it in server-side script. function resStarts(startedRes) setTimer(check, 1000, 0) end function check() for i, v in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(v) if(y > 4000) then killPed(v) end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resStarts) This script work but he said -4000 ( I know, is not stupid but ... ) And no answer from Azu so we can say that he founds the solution to make that 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