joedajoester Posted January 23, 2012 Share Posted January 23, 2012 How would you make a picture or text appear somewhere on the map with dxdrawtext? Do you attach it or something? Edit: getScreenFromWorldPosition(0,0,0) Would this work? And would i need to check line of sight? Link to comment
Castillo Posted January 23, 2012 Share Posted January 23, 2012 local distance = 70 local screenSizeX, screenSizeY = guiGetScreenSize() local scale = 7 local myImage = "mtalogo.png" local x, y, z = 0, 0, 5 function renderImage() local px, py, pz = getElementPosition ( localPlayer ) local dist = getDistanceBetweenPoints3D ( px, py, pz, x, y, z ) if (dist < distance and isLineOfSightClear( px, py, pz, x, y, z, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( x, y, z+0.5 ) local scaled = screenSizeX * (1/(2*(dist+5))) *.85 local relX, relY = scaled * scale, scaled * scale if ( screenX and screenY ) then dxDrawImage( screenX, screenY, relX, relY, tostring(myImage) ) end end end addEventHandler( "onClientRender", root, renderImage ) Change: x, y, z to your 3D world coordinates. Link to comment
joedajoester Posted January 23, 2012 Author Share Posted January 23, 2012 Which xyz? all of them *edit getscreenfromworldposition x y z coordinates? Link to comment
Castillo Posted January 23, 2012 Share Posted January 23, 2012 Don't you see the variables in the top of the script? Line: #5: local x, y, z = 0, 0, 5 Link to comment
joedajoester Posted January 24, 2012 Author Share Posted January 24, 2012 How would i do text? Link to comment
Castillo Posted January 24, 2012 Share Posted January 24, 2012 You can either learn from that script or you can check this out: https://community.multitheftauto.com/index.php?p= ... ls&id=3090 That resource is used to create 3D text's, you can study how it's scripted. Link to comment
joedajoester Posted January 24, 2012 Author Share Posted January 24, 2012 Ok, I have no clue how to do text so i just use gimp and put text and remove the background. How would I attach it to a element like how the playername is attached to the player how would I do that or for a car? Thanks 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