Klesh Posted May 2, 2011 Share Posted May 2, 2011 Hi community of MTA, my problem is this How i can get the camera coords like this <camera lookX="2494.5971679688" lookY="-1673.1807861328" lookZ="13.335947036743" posX="2457.0390625" posY="-1647.9575195313" posZ="48.245067596436"/> I want a new code i try with spawns in the air and all that but nothing works, the camera or appears in anotherside or the look camera is not, pls help. Link to comment
Moderators Citizen Posted May 2, 2011 Moderators Share Posted May 2, 2011 Your .xml or .map: <blabla> <camera lookX="2494.5971679688" lookY="-1673.1807861328" lookZ="13.335947036743" posX="2457.0390625" posY="-1647.9575195313" posZ="48.245067596436"/> </blabla> the code: function getCameraData() local path = "meta.xml" -- maybe it's a .map so replace meta.xml by the correct name local xml = xmlLoadFile( path ) local childs = xmlNodeGetChildren( xml ) local find = false local x,y,z,lx,ly,lz = 0, 0, 0, 0, 0, 0 for k,i in ipairs ( childs ) do if ( xmlNodeGetName ( i ) == "camera" ) then find = true x = xmlNodeGetAttribute( i, "posX" ) y = xmlNodeGetAttribute( i, "posY" ) z = xmlNodeGetAttribute( i, "posZ" ) lx = xmlNodeGetAttribute( i, "lookX" ) ly = xmlNodeGetAttribute( i, "lookY" ) lz = xmlNodeGetAttribute( i, "lookZ" ) end end if ( find ) then return tonumber(x),tonumber(y),tonumber(z),tonumber(lx),tonumber(ly),tonumber(lz) else outputDebugString( "ERROR: Couldn't find any camera node in "..path.." !" ) return false end end --Exemple: function bla() local x,y,z,lx,ly,lz = getCameraData() --the instructions end don't forget your .xml or .map in your meta.xml and type="client" if you want to use it in client-side 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