Lalalu Posted June 11, 2017 Share Posted June 11, 2017 Hello, i'm doing this post today because i need help with this. I've tried everything but i have not succeeded, i want to know how i can center this image under my feets, i mean, under the player, ¡just there! without losing that size ((( x, y, z_ground, 1, 2.5))) in the picture.. This is the script script, i hope u can help me with this pleaaaaaase local imagen = dxCreateTexture( "test.png" ) local activado = { } local players = getElementsByType( 'player' ) function dxDrawImage3D(x,y,z,w,h,m,c,r,...) local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...) end addEventHandler( "onClientRender", root, function( ) for i=1, #players do local p = players[i] if activado[ p ] == true then local x, y, z = getElementPosition( p ) local z_ground = getGroundPosition( x, y, z ) dxDrawImage3D( x, y, z_ground, 1, 2.5, imagen, tocolor( 0, 255, 230, 255 ), 0, x, y, z ) end end end ) function removeEffect( player ) if activado[ player ] == true then activado[ player ] = nil end end addEvent( "vip:farvel", true ) addEventHandler( "vip:farvel", getRootElement( ), function( player ) if not activado[ player ] or activado[ player ] == nil then activado[ player ] = true setTimer( removeEffect, 5000, 1, player ) end end ) Thanks, also, i hope you can read this and help me. Link to comment
AE. Posted June 11, 2017 Share Posted June 11, 2017 use ped bone getPedBonePosition ( yourplayer,44 ) Link to comment
Lalalu Posted June 11, 2017 Author Share Posted June 11, 2017 (edited) If i attach it to a bone, when i'll do an animation the image will move with me, and i don't want that Edited June 11, 2017 by Lalalu Link to comment
AE. Posted June 11, 2017 Share Posted June 11, 2017 who said that you will attach to the bone? Link to comment
Lalalu Posted June 11, 2017 Author Share Posted June 11, 2017 (edited) addEventHandler( "onClientRender", root, function( ) for i=1, #players do local p = players[i] if activado[ p ] == true then local x, y, z = getElementPosition( p ) local z_ground = getGroundPosition( x, y, z ) getPedBonePosition ( player,3 ) dxDrawImage3D( x, y, z_ground, 1, 2.5, imagen, tocolor( 0, 255, 230, 255 ), 0, x, y, z ) end end end ) something like this? Edited June 11, 2017 by Lalalu Link to comment
AE. Posted June 11, 2017 Share Posted June 11, 2017 i think it's better to keep the first code and play with x + y addEventHandler( "onClientRender", root, function( ) for i=1, #players do local p = players[i] if activado[ p ] == true then local x, y, z = getElementPosition( p ) local z_ground = getGroundPosition( x, y, z ) dxDrawImage3D( x+0.4, y+0.4, z_ground, 1, 2.5, imagen, tocolor( 0, 255, 230, 255 ), 0, x, y, z ) end end end ) try to play with it until it be under the player feet Link to comment
AE. Posted June 11, 2017 Share Posted June 11, 2017 i told you to play with the x + y not to copy pasta my code :3 Link to comment
Lalalu Posted June 11, 2017 Author Share Posted June 11, 2017 still not working x2 , lmao Link to comment
Moderators IIYAMA Posted June 11, 2017 Moderators Share Posted June 11, 2017 ? dxDrawImage3D( x-0.5, y-1.25, z_ground, 1, 2.5, imagen, tocolor( 0, 255, 230, 255 ), 0, x, y, z +1 ) Using not a square image is a terrible mistake, but try this. 2 hours ago, Lalalu said: still not working x2 , lmao And would you please stop that. Saying that is means the same as: 'I am too lazy to follow instructions and I will be waiting for somebody else to do it for me' You don't want to say that to people that are trying to help you. 1 Link to comment
Lalalu Posted June 11, 2017 Author Share Posted June 11, 2017 sorry? jesus. I didn't say it in a bad way, i said that it did not work simply and nothing else, i did not give him instructions, nor did I tell him what to do, and in fact he helped me a lot, i understood certain things, he offered to help me, i never told him to do all the work, I'm not a "scripter" or anything like that, but that doesn't mean that i'm a jerk and i let them do all the work, so.. thanks. Link to comment
Moderators IIYAMA Posted June 12, 2017 Moderators Share Posted June 12, 2017 @Lalalu I know you didn't want to say that, because that would be very inhuman, but I just informed you what kind of effect it would have when a scripter says that to a scripter. You do not want people to get angry right? Then take my advice. Another thing, this is the scripting section. If you post code here, everybody would expect you to be a scripter. If you aren't a scripter, then make sure to write that down at the start of the topic. If you do not write that down, people would expect you to be capable of solve small adjustments like this. So make sure that the helpers are aware of your limitations. If I knew that you were not a scripter, I wouldn't have pointed out that this matter in the first place. I hope this information will help you in the future. Is the image position correct now? If not, be specific and show results(screenshots + code for example). 1 Link to comment
Lalalu Posted June 12, 2017 Author Share Posted June 12, 2017 (edited) Yes, you have reason, and yeah it's already working with your line, 1000thank you, but i think..., i mean, i want to edit some more because i want to understand a little bit more about dxDrawImage3d Edited June 12, 2017 by Lalalu 1 Link to comment
Moderators IIYAMA Posted June 12, 2017 Moderators Share Posted June 12, 2017 dxDrawImage3D( x - 0.5, y - 1.25, z_ground, 1, 2.5, imagen, tocolor( 0, 255, 230, 255 ), 0, x, y, z +1 ) █XSIZE / 2 = █XOFFSET █YSIZE / 2 = █YOFFSET -- I am HERE on the LEFT / TOP-- -----\--/----- ------\/------ --LEFT / TOP-------------------- -------------------------------- -------------------------------- -------------------------------- ----------------RIGHT / BOTTOM-- LEFT / TOP = player position The size will be added in to the direction of the RIGHT / BOTTOM corner. SIZE > +\/ + Subtract 50% of the X Size and Y Size of the LEFT / TOP, will adjust the image position so that the image middle position is at the player position. --LEFT / TOP-------------------- -------------------------------- -------I WANT TO BE HERE-------- -------------------------------- ----------------RIGHT / BOTTOM-- Link to comment
Lalalu Posted June 15, 2017 Author Share Posted June 15, 2017 Thanks n.n, i already understand 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