emreb Posted June 25, 2014 Share Posted June 25, 2014 I am getting BadArgument @ setelementposition error on debug script. whats wrong with my script? I am really new on lua. function jumper () local playerpos = getLocalPlayer() local x, y, z = getElementPosition ( playerpos ) setElementPosition ( source, x, y, 100 ) end addCommandHandler ( "jump", jumper ) Link to comment
Et-win Posted June 25, 2014 Share Posted June 25, 2014 function jumper () local playerpos = getLocalPlayer() local x, y, z = getElementPosition ( playerpos ) setElementPosition ( getLocalPlayer(), x, y, 100 ) end addCommandHandler ( "jump", jumper ) Link to comment
Cruze Posted June 25, 2014 Share Posted June 25, 2014 function jumper () local playerpos = getLocalPlayer() local x, y, z = getElementPosition ( playerpos ) setElementPosition ( getLocalPlayer(), x, y, 100 ) end addCommandHandler ( "jump", jumper ) huh, didn't you notice that he used local playerpos = getLocalPlayer()?, so instead of repeating getLocalPlayer(), using playerpos would fit. Link to comment
Et-win Posted June 25, 2014 Share Posted June 25, 2014 huh, didn't you notice that he used local playerpos = getLocalPlayer()?, so instead of repeating getLocalPlayer(), using playerpos would fit. Yes I did. Link to comment
Moderators IIYAMA Posted June 25, 2014 Moderators Share Posted June 25, 2014 Just simply use localPlayer inside your whole client code. It is a predefined variable and it is shorter so you have to write less characters. (and it is 1 ms faster then getLocalPlayer(), because it isn't a function.) . 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