weedsawq Posted May 6, 2019 Share Posted May 6, 2019 I will type "/ search" on the server and cameraTarget appears on the client but, taking the camera position on the server, i get "ipairs, table expected got nil"client.lua function engineobj ( message, sasr ) for k,v in ipairs ( objs,"sasr" ) do if k == objs then outputChatBox ( "#FF0000CAM: " ..message.."", 255 ,255 ,255, true) local px, py, pz = getElementPosition ( isElement(sasr)) setCameraTarget ( px, py, pz[k]) outputConsole ( "CAMC: " ..px.. " " ..py.. " " ..pz ) end end if not ( (k) "sasr" ) then outputChatBox ( "#FF0000*Not Object available*", getRootElement(), 255, 255, 255, true ) end end addEvent( "onSearch", true ) addEventHandler( "onSearch", resourceRoot, engineobj ) Link to comment
aka Blue Posted May 6, 2019 Share Posted May 6, 2019 (edited) I think the problem is in the 7 line. getElementPosition returns 3 floats, not table values, so, you can't index them. PD: And... the loop is wrong. Edited May 6, 2019 by aka Blue 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