Jump to content

ronaldoguedess

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by ronaldoguedess

  1. I did have tried that, but this only disable mouse key fire... and doesn't disable the "CTRL" key fire I did have tried that, but this only disable mouse key fire... and doesn't disable the "CTRL" key fire Thanks Man! It's Works now! function playerPressedKey(button, press) if (press) then if button == "lctrl" or button == "rctrl" then cancelEvent() return true end end end addEventHandler("onClientKey", root, playerPressedKey)
  2. I don't want the player take a punch! I need disable "CTRL" key for impeding that player take a punch. I try this: toggleControl ( source, "fire", false ) but only disable mouse key fire... and doesn't disable the "CTRL" key fire ...
  3. But the problem is not the windows 8, because the MTA 1.4.1 runs perfectly at 60 FPS ... but i.5 is 9 FPS.
  4. Are you using Windows 10? If so, then you'll have to wait for a new build to come or until the MTA team solves the problem when Win10 gets officially released. I am using widowns 8.1. enough friends commented on this low FPS of 1.5 mta problem.
  5. This update is a problem! My FPS is between 9 and 11. some function became deprecated?
  6. I found the answer here in the forum, but I ask you to let my topic! will be able to help many people with the same problem! the problem is in attachElementToBone. Replace all lines of the file "bone_pos_rot.lua" by these code below! sx, sy, sz = 0, 0, 3 tx, ty, tz = 0, 0, 4 fx, fy, fz = 0, 1, 3 function getMatrixFromPoints(x, y, z, x3, y3, z3, x2, y2, z2) x3 = x3 - x y3 = y3 - y z3 = z3 - z x2 = x2 - x y2 = y2 - y z2 = z2 - z local x1 = y2 * z3 - z2 * y3 local y1 = z2 * x3 - x2 * z3 local z1 = x2 * y3 - y2 * x3 x2 = y3 * z1 - z3 * y1 y2 = z3 * x1 - x3 * z1 z2 = x3 * y1 - y3 * x1 local len1 = 1 / math.sqrt(x1 * x1 + y1 * y1 + z1 * z1) local len2 = 1 / math.sqrt(x2 * x2 + y2 * y2 + z2 * z2) local len3 = 1 / math.sqrt(x3 * x3 + y3 * y3 + z3 * z3) x1 = x1 * len1 y1 = y1 * len1 z1 = z1 * len1 x2 = x2 * len2 y2 = y2 * len2 z2 = z2 * len2 x3 = x3 * len3 y3 = y3 * len3 z3 = z3 * len3 return x1, y1, z1, x2, y2, z2, x3, y3, z3 end function getEulerAnglesFromMatrix(x1, y1, z1, x2, y2, z2, x3, y3, z3) local nz1, nz2, nz3 nz3 = math.sqrt(x2 * x2 + y2 * y2) nz1 = -x2 * z2 / nz3 nz2 = -y2 * z2 / nz3 local vx = nz1 * x1 + nz2 * y1 + nz3 * z1 local vz = nz1 * x3 + nz2 * y3 + nz3 * z3 return math.deg(math.asin(z2)), -math.deg(math.atan2(vx, vz)), -math.deg(math.atan2(x2, y2)) end function getMatrixFromEulerAngles(x, y, z) x, y, z = math.rad(x), math.rad(y), math.rad(z) local sinx, cosx, siny, cosy, sinz, cosz = math.sin(x), math.cos(x), math.sin(y), math.cos(y), math.sin(z), math.cos(z) return cosy * cosz - siny * sinx * sinz, cosy * sinz + siny * sinx * cosz, -siny * cosx, -cosx * sinz, cosx * cosz, sinx, siny * cosz + cosy * sinx * sinz, siny * sinz - cosy * sinx * cosz, cosy * cosx end if not script_serverside then function getBoneMatrix(ped,bone) local x,y,z,tx,ty,tz,fx,fy,fz x,y,z = getPedBonePosition(ped,bone_0[bone]) if bone == 1 then local x6,y6,z6 = getPedBonePosition(ped,6) local x7,y7,z7 = getPedBonePosition(ped,7) tx,ty,tz = (x6+x7)*0.5,(y6+y7)*0.5,(z6+z7)*0.5 elseif bone == 3 then local x21,y21,z21, x31,y31,z31 x21,y21,z21 = getPedBonePosition(ped,21) x31,y31,z31 = getPedBonePosition(ped,31) if math.round(x21, 2) == math.round(x31, 2) and math.round(y21, 2) == math.round(y31, 2) and math.round(z21, 2) == math.round(z31, 2) then x21,y21,z21 = getPedBonePosition(ped,21) local _,_,rZ = getElementRotation(ped) tx,ty,tz = getPointInFrontOfPoint(x21, y21, z21, rZ, 0.0001) else tx,ty,tz = (x21+x31)*0.5,(y21+y31)*0.5,(z21+z31)*0.5 end else tx,ty,tz = getPedBonePosition(ped,bone_t[bone]) end fx,fy,fz = getPedBonePosition(ped,bone_f[bone]) local xx,xy,xz,yx,yy,yz,zx,zy,zz = getMatrixFromPoints(x,y,z,tx,ty,tz,fx,fy,fz) if bone == 1 or bone == 3 then xx,xy,xz,yx,yy,yz = -yx,-yy,-yz,xx,xy,xz end return xx,xy,xz,yx,yy,yz,zx,zy,zz end function getPointInFrontOfPoint(x, y, z, rZ, dist) local offsetRot = math.rad(rZ) local vx = x + dist * math.cos(offsetRot) local vy = y + dist * math.sin(offsetRot) return vx, vy, z end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end end The solution of the problem was posted by a member: haron4igg
  7. Hello friends, okay? I have a big problem in one part of my code! The "attachElementToBone" does not work as it should when I'm using the skin id (0) attachElementToBone(elementBackpack[source], source, [b]3[/b], 0, -0.225, 0.05, 90, 0, 0) when I use other skin works perfectly! I made a video to illustrate my doubts! I hope you can help me! Hugs.
  8. que bom que ficou alegre! eu te mostrarei assim que finalizar! esta quase la! me diga, quais são suas ideias para essa GM? pretende add novas funcionalidades a ela? ou por enquanto vai apenas reescrever o código? Abrass
  9. Parabéns pela iniciativa de criação do projeto em OpenSource. Gostei muito daquela simplificação que vc fez no sistema de replace de itens, e tmb na forma que esta reorganizando tudo! Esta ficando muito bom! Parabéns! Eu, aprendi muito com o código que foi vazado do dayz, não sabia nada de programação lua e graças a ele eu aprendi a dominar os recursos e a criar quase tudo que vem na cabeça! apenas lendo o código é como se eu tivesse vendo ele funcionando! Estou criando uma versão do dayz a quase um ano, esta super diferente de tudo que já vi por ai! quando eu terminar, vou te convidar pra conhecer!! Abraçõs e to por aqui acompanhando!
  10. Parabéns pelo tutorial, vai ajudar muita gente a deixar o servidor melhor! realmente é horrível entrar em servidor cheio de blips! Ficou otimooooooooo mesmo! nota 1000. bem explicadinho!
  11. Boa indicação meu amigo! Eu apóio sua indicação! Realmente pelo tutorial que ele fez deve ter um grande conhecimento e ele pode ajudar bastante no crescimento do fórum mta br. Parabéns pela iniciativa, tem tudo pra se tornar uma grandiosa enciclopédia de MTA no brasil.
  12. but this way, all the dxImage dxretangle and would stay that color too! I would use a shader to do that! do you know any?
  13. Thanks for answering! but I want to leave this way:
  14. Good afternoon, How can I let the player screen in black and white?
  15. Thank lopezloo , it worked! get it now ! Tails , Thank you too! gave everything right here! ^^ Now my system has become much more sophisticated! heheh
  16. Thank you friend! Thank same! was granade help ... now I would like to set an effect to a vehicle. I noticed that there is a "AttachEffect" function that would be better than the "onclientRender": https://wiki.multitheftauto.com/wiki/AttachEffect q u think? however I could not make it work! hugs
  17. I noticed that when running just the camera, the red dot (north) does not move. And the rest of blips, they also managed to put? hugs
  18. Ola como vai? conseguiu algum resultado no radar?
  19. Friends, I wonder if there is any smoke shader for me to put on the fire?
  20. I wanted to do as a benefit for those who have enough Experience. but I think they should create this function natively, so we would have the option to use or not use. needed so that system! would be really cool!
  21. Goodnight everyone ... went back to work in resourcer and am having major problems ... - If the target is higher or lower the automatic crosshair gets wrong. - Depending on the angle that the player is not the shot hits the target. I tried to make corrections, but I can not succeed in any way! This is the most complicated system I tried to do. Anyone willing to help me? local localPlayerName = getPlayerName(getLocalPlayer()) local function getPedsOnScreen() --outputChatBox("Chama: getPedsOnScreen ^^") local peds = {} for key, ped in ipairs(getElementsByType("ped", root, true)) do if isElementOnScreen(ped) and isPedDead(ped) == false then table.insert(peds, ped) --if getElementType(ped) == "ped" then end end return peds end function funcInput() getPedsOnScreen() refreshPeds() end addEventHandler("onClientRender", root, funcInput) local function dxDrawCircle(posX, posY, radius, width, angleAmount, color, postGUI) radius = radius or 20 width = width or 1 angleAmount = angleAmount or 1 color = color or tocolor(255, 255, 255, 150) postGUI = postGUI or false for i=0,360,angleAmount do local _i = i*(math.pi/180) --dxDrawImage ( posX, posY, 6, 6, 'target.png') dxDrawLine(math.cos(_i)*(radius-width)+posX, math.sin(_i)*(radius-width)+posY, math.cos(_i)*(radius+width)+posX, math.sin(_i)*(radius+width)+posY, tocolor(255, 0, 0), width, postGUI) end return true end local function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end local function sortbyrot(a, b) local _, _, rz = getElementRotation(localPlayer) local x, y = getElementPosition(localPlayer) local ax, ay = getElementPosition(a) local bx, by = getElementPosition(b) local arz = findRotation(x, y, ax, ay) arz = math.abs(rz - arz) local brz = findRotation(x, y, bx, by) brz = math.abs(rz - brz) return arz < brz end function refreshPeds() --outputChatBox("Chama: refreshPeds ^^") local peds = getPedsOnScreen() if #peds > 0 then table.sort(peds, sortbyrot) StreamedPlayers = peds[1] --outputChatBox("Maior que 1") end end refreshPeds() local x,y,z = getElementPosition( getLocalPlayer ()) local distMax = 30 local dx,dy = guiGetScreenSize() aimX ,aimY = dx*0.54 , dy*0.3971 function AimOnPosition(weapon) local setToX,setToY = 0,0 local hx, hy, hz = getPedBonePosition(StreamedPlayers, 6) local sx,sy = getScreenFromWorldPosition(hx,hy,hz) setToX = math.abs(dx/2-(aimX)) setToY = math.abs(dy/2-(aimY)) local a1,a2,a3 = getPedBonePosition(StreamedPlayers, 6) local a4,a5,a6 = getElementPosition(StreamedPlayers) local b1,b2,b3 = getElementPosition(localPlayer) local dist = getDistanceBetweenPoints3D(a1,a2,a3,b1,b2,b3) local difZ = (a3 - b3) --outputChatBox("".. math.floor(difZ) .." ") outputChatBox("distanc: "..math.floor(dist).."") ------------------------------------------- if weapon then aimX = dx*0.54 offsetheight = 0.2 distMin = 8 end setToX,setToY = getWorldFromScreenPosition(sx-setToX,sy+setToY,dist) _,_,setToX1 = getWorldFromScreenPosition(dx/2,dy/2,dist) _,_,setToX2 = getWorldFromScreenPosition(aimX,aimY,dist) setToX3 = (setToX2 - setToX1) local sx, sy = getScreenFromWorldPosition(hx, hy, hz) local angL = findRotation(a1, a2, b1, b2) outputChatBox("Angulo: "..math.floor(angL).."") if angL >= 130 and angL <= 145 then if dist <= 32 then ajuS = (dist * 0.003) elseif dist >= 33 and dist <= 40 then ajuS = (dist * 0.003) elseif dist >= 41 and dist <= 50 then ajuS = (dist * 0.001) end elseif angL >= 146 and angL <= 270 then if dist <= 32 then ajuS = (dist * 0.006) end if dist >= 33 and dist <= 40 then ajuS = (dist * 0.002) end if dist >= 41 and dist <= 50 then ajuS = (dist * 0.001) end --25m = 0.006 --40m = 0.002 --50m = 0.001 elseif angL >= 271 and angL <= 320 then if dist <= 32 then ajuS = (dist * 0.004) end if dist >= 33 and dist <= 40 then ajuS = (dist * 0.001) end if dist >= 41 and dist <= 50 then ajuS = (dist * 0.02) end else ajuS = (dist * 0.006) end if dist <= 50 and dist >=25 then -------------------------------- if dist > 25 then if dist >= 25 and dist <= 49 then offS = 0.15 elseif dist >= 50 then offS = 0.05 end setCameraTarget(setToX-ajuS+offS, setToY-ajuS+offS, b3-setToX3+0.2 +(a6-b3)) if sx then --dxDrawCircle(sx, sy) --marca na cabeça (sx, sy) setPedTargetingMarkerEnabled ( falso ) end end ------------------------------- end end function drawStuff() local weapon = getPedWeapon(localPlayer) if getControlState("aim_weapon")then if ( isPedDead ( StreamedPlayers ) == false ) and weapon and weapon > 0 and getElementData(localPlayer, "logedin") and localPlayerName == "ronaldoguedess" then --getPedsOnScreen() --refreshPeds() AimOnPosition(weapon) end end end addEventHandler("onClientRender", root, drawStuff)
×
×
  • Create New...