Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by botder

  1. ENG You can easily do that with scripting PL Można to łatwo zrobić za pomocą skryptu
  2. botder

    GUI Tooltips

    I made a resource solution, that means a single resource handles the rendering for every gui element, which has a tooltip element data. Example: Result: Code:
  3. botder

    GUI Tooltips

    My mistake. Use that
  4. botder

    GUI Tooltips

    You have to make tooltips by yourself with DirectX functions (use the GUI events Focus and Blur to know which gui element is being hovered).
  5. I changed your code, here: local map_setSoundProperty = {["SampleRate"] = 1, ["Tempo"] = 2, ["Pitch"] = 3, ["Reversed"] = 4} function setSoundProperty(sound, property, value) -- Only handle sound elements if (not isElement(sound) or getElementType(sound) ~= "sound") then return end -- Get the current properties local properties = { getSoundProperties(sound) } -- Get the index by using the property parameter local index = map_setSoundProperty[property] -- Apply the value if there is an index for it if (index) then properties[index] = tonumber(value) end -- Return the property-success boolean return setSoundProperties(sound, unpack(properties)) end function applyDopplerEffectToSound(sound) -- Get the receiver (use localPlayer if we have no vehicle) local receiver = { e = getPedOccupiedVehicle(localPlayer) } if (not receiver.e) then receiver.e = localPlayer end -- Get the sender (abort if it's invalid or if it equals to the receiver) local sender = { e = getElementAttachedTo(sound) } if (not sender.e or sender.e == receiver.e) then return end -- Receiver information receiver.p = { getElementPosition(receiver.e) } receiver.v = { getElementVelocity(receiver.e) } -- Sender information sender.p = { getElementPosition(sender.e) } sender.v = { getElementVelocity(sender.e) } -- Distance calculation (abort if there is no distance) local dx, dy, dz, d = getDistanceBetweenPoints(receiver.p, sender.p) if (d < 1) then return end -- Calculate velocity dotproduct for receiver and sender sender.vs = getVelocityDotproduct(sender.v, dx, dy, dz, d) receiver.vr = getVelocityDotproduct(receiver.v, dx, dy, dz, d) -- Calculate pitch local p = ((1 + receiver.vr) / (1 + sender.vs)) * (4.5 * math.max(0, sender.vs - receiver.vr)) setSoundProperty(sound, "Pitch", p) end function getDistanceBetweenPoints(pointA, pointB) local x, y, z = math.abs(pointB[1] - pointA[1]), math.abs(pointB[2] - pointA[2]), math.abs(pointB[3] - pointA[3]) local distance = getDistanceBetweenPoints3D(pointA[1], pointA[2], pointA[3], unpack(pointB)) return x, y, z, distance end function getVelocityDotproduct(point, dx, dy, dz, d) if (d == 0) then return 1 end return (math.abs(point[1] * dx) + math.abs(point[2] * dy) + math.abs(point[3] * dz)) / d end
  6. Difficulty is relative, but even with extra obfuscation it's still easy.
  7. Try this code: addEventHandler("onClientRender", root, function () -- Get every sound local sounds = getElementsByType("sound") -- Abort if there is no sound active if (#sounds == 0) then return end -- Get if possible my vehicle local me = getPedOccupiedVehicle(localPlayer) -- Else use my ped if (not isElement(me)) then me = localPlayer end -- Get our position local mpX, mpY, mpZ = getElementPosition(me) -- Get our velocity local mvX, mvY, mvZ = getElementVelocity(me) -- Loop through the sounds for index = 1, #sounds do -- Get the current sound by index local sound = sounds[index] -- Get the element, which the sound is attached to local attachedto = getElementAttachedTo(sound) -- Continue if the sound is attached to a vehicle if (isElement(attachedto) and getElementType(attachedto) == "vehicle") then -- Get the vehicle's position local tpX, tpY, tpZ = getElementPosition(attachedto) -- Calculate the distance between him and us local dX, dY, dZ = distance(mpX, mpY, mpZ, tpX, tpY, tpZ) -- Get the actual length from the distance local distance = getDistanceBetweenPoints3D(mpX, mpY, mpZ, tpX, tpY, tpZ) -- Get the vehicle's velocity local tvX, tvY, tvZ = getElementVelocity(attachedto) -- Calculate the dotproduct from velocity and distance for the sender local dpS = dotproduct(tvX, tvY, tvZ, dX, dY, dZ) -- Calculate the dotproduct from velocity and distance for the receiver local dpR = dotproduct(mvX, mvY, mvZ, dX, dY, dZ) -- Calculate teh vs value for the sender local vr = dpR / distance -- Calculate the vr value for the receiver local vs = dpS / distance -- Calculate the frequency (modified formula to improve the effect in GTA) local f = ((1 + vr) / (1 + vs)) * (4.5 * (vs - vr)) -- Adjust the sound volume setSoundVolume(sound, 1 - math.min(1, (distance + distance * 0.25) / 300)) -- Adjust the sound speed and effect local samplerate, _, _, reverse = getSoundProperties(sound) setSoundProperties(sound, samplerate, f, f, reverse) end end end ) function distance(x, y, z, a, b, c) return math.abs(a - x), math.abs(b - y), math.abs(c - z) end function dotproduct(x, y, z, a, b, c) return math.abs(x * a) + math.abs(y * b) + math.abs(z * c) end
  8. Interesting. Well, you should begin with having a mapping, which vehicle (or model) is using a sound. Then go ahead and make a onClientRender handler. In this handler you get the localPlayer's velocity and position (check for localPlayer's vehicle and use it if available), go through the mapping with a loop and get each vehicle's velocity and position aswell. In this loop you do the calculation as written on the sources you provided (shouldn't be too hard) and set the sound properties (create the sound if not done before). Play with the fPitch and fTempo values to get a nice effect. PlaySound SetSoundVolume SetSoundProperties OnClientRender
  9. text = text:gsub("\\t", " ") Maybe whitespace?
  10. Which indicator in the map resource would tell you if map has respawn or not?
  11. If you call a clientside exported function then it will be called for the player, whose script called the exported function. But if you call a serverside exported function, which should show an error message for a specific player, then you have to pass the player as a parameter and use it in the exported function defintion-file.
  12. Could you explain me how his script helped you, because he is using player-health and not vehicle-health as you wanted.
  13. function getVehicleHealthColor(vehicle) if (not isElement(vehicle)) then return end if (getElementType(vehicle) ~= "vehicle") then return end local health = getElementHealth(vehicle) local f = math.max(0, math.min(1, health / 1000)) return math.min(255, (510 * (1-f))), math.min(255, 510 * f), 0 end
  14. botder

    problems

    If you didn't compile the file yourself and if you can't decompile it etc. then you can't remove this loophole.
  15. botder

    problems

    That script has a backdoor which adds users to your ACL and you even added the resource the permission to allow that backdoor. Remove that backdoor from the script and remove the unknown users in your ACL if found. https://mtasa.com/2585/
  16. botder

    problems

    Why would he add it in ACL? Did I understand that wrong?
  17. botder

    problems

    Did you actually add the resource to the Admin group?
  18. Or use the option "Lock movement to axes" in the settings menu which does the same thing
  19. I don't know if you want to go that far, but you could try to convert the image file itself clientside and scale it up - requires much work but safes bandwith and weird shader workaround that may not even work
  20. But i need remove the string. What do you mean with remove the string? testTable[test][1] = nil testTable[test] = nil
  21. texture texture0; sampler Sampler0 = sampler_state { Texture = (texture0); }; struct PSInput { float2 TexCoord : TEXCOORD0; }; float4 PixelShader_Background(PSInput PS) : COLOR0 { float4 colors = tex2D(Sampler0, PS.TexCoord); if (colors.g == 1 && colors.r == 0 && colors.b == 0) { colors.a = 0; } return colors; } technique complercated { pass P0 { PixelShader = compile ps_2_0 PixelShader_Background(); } } technique simple { pass P0 { Texture[0] = texture0; } }
  22. botder

    Convert number

    Or use math.modf if you want the integer part without rounding
  23. In your rectangle rendering function: https://wiki.multitheftauto.com/wiki/GuiGetSelectedTab
×
×
  • Create New...