Ryuto Posted July 10, 2015 Posted July 10, 2015 Buenas gente, necesito ayuda con esto pues hace poco intente hacer un poder para Mta, me fue bien pero necesito que la imagen tenga rotación por ejemplo en este vídeo Dejare imágenes del mismo poder del vídeo, pero necesito saber como puedo hacer para que gire como en el vídeo x'D http://www.subeimagenes.com/img/1118229 ... 373643.jpg Dejare mi lua aquí. local white = tocolor(255,255,255,255) local x, y, z = 1964.216796875, -2365.044921875, 13 local zdj = dxCreateTexture("test.png") 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() dxDrawImage3D(x, y, z , 6, 6, zdj, tocolor(255,255,255,255),0, x, y, z +0.5) end) Muchas gracias por leer este post
Ryuto Posted July 11, 2015 Author Posted July 11, 2015 https://wiki.multitheftauto.com/wiki/SetElementRotationY lo puedes controlar, usando algunas otras cosas como onClientRender Y algunas sentencias condicionales como If Mm ya veo, ¿me darías un ejemplo para como ver como se utiliza?, gracias por ayudarme
Tomas Posted July 11, 2015 Posted July 11, 2015 setElementRotation no funcionará, los draws no son elementos.
Sasu Posted July 11, 2015 Posted July 11, 2015 local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end ) addEventHandler("onClientPreRender", root, function() local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end) Lo hice utilizando esta imagen: Pero si usas otra imagen, debes acomodar las posiciones de la anteúltima línea.
Ryuto Posted July 12, 2015 Author Posted July 12, 2015 local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end ) addEventHandler("onClientPreRender", root, function() local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end) Lo hice utilizando esta imagen: Pero si usas otra imagen, debes acomodar las posiciones de la anteúltima línea. Ya funciono quedo igual al vídeo, muchas gracias n.n, oye otra duda, con la función del set timer, ¿se puede hacer que quede pase 5 segundos y luego de esos 5 segundos desaparezca?
Ryuto Posted July 12, 2015 Author Posted July 12, 2015 Sí.Podrías usar: removeEventHandler Mm ya veo, ¿me podría dar un ejemplo?
Ryuto Posted July 12, 2015 Author Posted July 12, 2015 Si recibes un pequeño daño, se detiene local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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 function rotationImg() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end addEventHandler("onClientRender", root, rotationImg) function positionPed () local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end addEventHandler("onClientPreRender", root, positionPed) function Damage ( attacker, weapon, bodypart ) removeEventHandler("onClientRender", root, rotationImg) removeEventHandler("onClientPreRender", root, positionPed) end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Damage ) Genial, me también me podría servir pero, ¿se puede hacer que inicie con el comando /test y cuando aparezca, desaparezca a los 5 segundos?
Sticmy Posted July 12, 2015 Posted July 12, 2015 addCommandHandler setTimer ( function( ) removeEventHandler("onClientRender", root, test) end, 3000, 1) -- son 3 segundos cámbialo a 5 = 5000
Calculador Posted July 12, 2015 Posted July 12, 2015 Genial, me también me podría servir pero, ¿se puede hacer que inicie con el comando /test y cuando aparezca, desaparezca a los 5 segundos? local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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 function rotationImg() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end function positionPed () local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end function testing () addEventHandler("onClientRender", root, rotationImg) addEventHandler("onClientPreRender", root, positionPed) setTimer(function() removeEventHandler("onClientRender", root, rotationImg) removeEventHandler("onClientPreRender", root, positionPed) end, 5000, 1) end addCommandHandler("test", testing)
Ryuto Posted July 12, 2015 Author Posted July 12, 2015 Genial, me también me podría servir pero, ¿se puede hacer que inicie con el comando /test y cuando aparezca, desaparezca a los 5 segundos? local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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 function rotationImg() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end function positionPed () local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end function testing () addEventHandler("onClientRender", root, rotationImg) addEventHandler("onClientPreRender", root, positionPed) setTimer(function() removeEventHandler("onClientRender", root, rotationImg) removeEventHandler("onClientPreRender", root, positionPed) end, 5000, 1) end addCommandHandler("test", testing) Disculpa pero cuando pongo /test, no aparece nada
Guest Posted July 12, 2015 Posted July 12, 2015 Que yo recuerde, 'test' ya es un comando definido en MTA, por lo que yo sé, cualquier función que se ejecute con 'test' no funcionará, sólo cambia 'test' por otra palabra
Calculador Posted July 12, 2015 Posted July 12, 2015 Genial, me también me podría servir pero, ¿se puede hacer que inicie con el comando /test y cuando aparezca, desaparezca a los 5 segundos? local white = tocolor(255,255,255,255) local target = dxCreateRenderTarget(100, 100, true) local rotation = 0 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 function rotationImg() rotation = rotation < 360 and rotation + 10 or 0 dxSetRenderTarget(target, true) dxDrawImage ( 0, 0, 100, 100, "test.png", rotation ) dxSetRenderTarget() end function positionPed () local gx, gy, gz = getPedBonePosition(localPlayer, 25) dxDrawImage3D( gx-1.5, gy-1.5, gz+.1, 3, 3, target, tocolor(255,255,255,255), 0, gx-1.5, gy-1.5, gz+100) end function testing () addEventHandler("onClientRender", root, rotationImg) addEventHandler("onClientPreRender", root, positionPed) setTimer(function() removeEventHandler("onClientRender", root, rotationImg) removeEventHandler("onClientPreRender", root, positionPed) end, 5000, 1) end addCommandHandler("test", testing) Disculpa pero cuando pongo /test, no aparece nada Tranquilo, el error fue mio, olvide que no se puede poner "test" como comando, en la función "addCommandHandler". Prueba así: function testing () addEventHandler("onClientRender", root, rotationImg) addEventHandler("onClientPreRender", root, positionPed) setTimer(function() removeEventHandler("onClientRender", root, rotationImg) removeEventHandler("onClientPreRender", root, positionPed) end, 5000, 1) end addCommandHandler("lol", testing) Que yo recuerde, 'test' ya es un comando definido en MTA, por lo que yo sé, cualquier función que se ejecute con 'test' no funcionará, sólo cambia 'test' por otra palabra Exactamente, tienes la razón polluelo, ni "test", ni "list".
Calculador Posted July 12, 2015 Posted July 12, 2015 'list' no es un comando definido Pero no se puede usar. "Note: You cannot use "list" or "test" as command name."
Ryuto Posted July 12, 2015 Author Posted July 12, 2015 'list' no es un comando definido Pero no se puede usar. "Note: You cannot use "list" or "test" as command name." Muchas gracias ya quedo igual al vídeo, ahora solo me falta hacer que cause daño y es muy simple, no sabía eso del "test" ni del "list", ahora lo sé para futuros scripts, muchas gracias por ayudarme
Recommended Posts