Jump to content

Kazafka

Members
  • Posts

    143
  • Joined

  • Last visited

Posts posted by Kazafka

  1. 14 minutes ago, Tut said:

    Hey,

    As far as I can tell vehicles only support 3 colors in MTA, the 4th doesn't register for some reason. I believe vehicles.ide needs to be modified, something that MTA has no functions for at the moment.
    There is no wheel model in GTA SA that can be painted, but you can easily adapt them by adding the third vehicle paint code to the wheel DFF.

    What software can open a DFF file if I can ask?

  2. 24 minutes ago, Gordon_G said:

    Hi, 

    I highly advise you to take a look to the "bengine" ressource to take a look at how it actually works

     

    The main issue is that you have to disable EVERY VEHICLE SOUNDS for EVERY VEHICLES in order to achieve what you are trying to do (and that's how the previously mentionned resource works)

    Well, problem is, that whenever I start the resource and spawn a new vehicle, I have NO sounds. I mean, I was using bengines a long time ago before, and it played custom engine sounds. Now, it doesn't.

  3. 9 minutes ago, IIYAMA said:

     

    I haven't done/tested this before, but you can change the vehicle engine type. Not sure if that affects the audio as well.

    
    
    
    setVehicleHandling ( theVehicle, "engineType", "electric")

     

     

    No, it doesn't affect the audio.

    EDIT#1: I've tested that before in normal GTA San Andreas. If engine type of cars in San Andreas would make a difference (e.g. in sound, acceleration, etc.), I wouldn't start this thread.

  4. 2 hours ago, SpecT said:

    setWorldSoundEnable is exactly what you need but you will need to experiment to see which one is for the electric cars you will use.
    For example:

    
    setWorldSoundEnable(40, false)

    This will mute the engine sound but you will still hear the idling so you need to mute from ID 7 to 16 (depends on the car).

    Here is the list of the world sound groups: World_sound_groups

     

    1 hour ago, Hydra said:
    
    function s()
      for i = 7, 16 do
        setWorldSoundEnabled(i, false)
        end
      end

     

    Unfortunately, nope. I mean, when I use setWorldSoundEnabled I can't hear engine sound of a Bullet, driven by my friend.

  5. Hello!

    I'm back after a big break. I began playing on my MTA server again. Today, I tried to add electric cars to my server. It's almost done, but there is still only one thing left to achieve. Well, I am trying to disable ALL engine sounds, for electric cars, to make them more realistic. So, I've looked up for some resources, nothing helped. setWorldSoundEnable - I don't know if this function can disable sounds for a specific entity, I only know, that it completely disables all sounds from a specific world sound group.

    Any ideas?

  6. 1 minute ago, Patrick said:

    Multi Theft Auto still surprises me with it's possibilities. Well, what would I expect from R* games themselves...

    Thank you!

    8 minutes ago, Patrick said:

    The resource that you have gave me is really cool and does the job, but, when I press the control for the mirror, the game starts being laggy... :(

  7. Hi! I wasn't active for quite a long time, because I started playing GTA V.

    So I'm back with yet another question! Well, I wanted to know, if there is any way to get, and optionally view it with DX or something, what player camera sees in the moment...

    The cause of this, is because I wanted to make a mirror for the cars, so players can easily see what's behind them. Of course, I wanted to add this feature to my whole car system, which's for now including a complete loader for custom shops, speedometer, supported RGB colors and upgrades when saving and reading car info, etc.

    BTW, i dont know why, but when i posted this question first, my browser stopped working and the post actually has been added to the forum, sorry for this duplicate.

    Any ideas?

  8. 3 hours ago, Geo said:


    Would you be able to post your answer so people that encounter your problem in the future be able to use this as reference / solution?

    Here you go:

    To convert string like "element one, element two, element three" to table, you do:

    str = "element one, element two, element three"
    tab = string.split(string, ", ")

    To convert table like {"element one", "element two", "element three"} back, to string you do:

    tab = {"element one", "element two", "element three"}
    str = table.concat(tab, ", ")

    Hope I helped you too!

  9. 4 hours ago, Geo said:

    Are any of these values assigned to a variable?

     

    
    t = {1001, 1086, 1025}
    

    or if they're:

    
    t = {a,b,c}
    

     

    Well, i converted this table:

    {1015, 1008, 1087, 1086, 1084}

    To this string using table.concat():

    "1015, 1008, 1087, 1086, 1084"

    Now, how can I un-concat this string, to make it table again??

    Any ideas?

    CLOSE THIS TOPIC, I HAVE AN ANSWER!!!

  10. 7 hours ago, Tut said:

    I believe you're looking for an alpha mask, but it's a little unclear what exactly is wanted. Have a look at these nonetheless.

    https://forum.multitheftauto.com/topic/60602-rel-50p-masking-textures-shader/

    https://wiki.multitheftauto.com/wiki/Shader_examples (at the bottom, mask hud)

    I can only give these references since scripting is not my field. I hope it leads to help though.

    Ok, im trying right now with another render target.

  11. Code:

    function getElementSpeed(theElement, unit)
        -- Check arguments for errors
        assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
        local elementType = getElementType(theElement)
        assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
        assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
        -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
        unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
        -- Setup our multiplier to convert the velocity to the specified unit
        local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
        -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
        return (Vector3(getElementVelocity(theElement)) * mult).length
    end
    
    function isElementOutSide(elem)
    	if elem then
    		if getElementInterior(elem) == 0 then
    			return true
    		else
    			return false
    		end
    	else
    		return false
    	end
    end
    
    pliki = {
    	mapa = "files/map.png", --Domyślna tekstura mapy
    	gracz = "files/player.png", --Domyślna tekstura gracza
    }
    	
    hud = {
    	szer = 320, --Długość i wysokość radaru, tego nie zmieniamy pod żadnym pozorem
    	przez = 200, --Przeźroczystość
    	unit = 3000 / 6000, --Unity, radzę nie zmieniać
    	wiel = 320, --Wielkość mapy, też radzę nie zmieniać
    	rot = true --Obrót minimapki
    }
    
    ustawienia = {
    	dispHud = true, --Wyświatlaj mapę
    	current_minimap = 2 --Obecna tekstóra minimapy
    }
    
    deweloper = {
    	false, --Opcja dewelopera #1
    	false, --Opcja dewelopera #2
    	false --Opcja dewelopera #3
    }
    
    addEventHandler("onClientResourceStart", resourceRoot, function()
    	setPlayerHudComponentVisible("radar", false)
    	
    	minimap = dxCreateRenderTarget(hud.szer, hud.szer, true)
    	full = dxCreateRenderTarget(hud.szer + 5, hud.szer + 5, true)
    end)
    
    addEventHandler("onClientResourceStop", resourceRoot, function()
    	setPlayerHudComponentVisible("radar", true)
    end)
    
    addEventHandler("onClientRender", root, function()
    	if ustawienia.dispHud then
    		local w, h = guiGetScreenSize()
    	
    		local x, y, z = getElementPosition(localPlayer)
    		
    		local rx, ry, rz = getElementRotation(localPlayer)
    		
    		local x = x * hud.unit
    		local y = y * hud.unit
    		
    		if deweloper[1] then
    			outputChatBox(tostring(x) .. ", " .. tostring(y))
    		end
    		
    		dxSetRenderTarget(minimap, false)
    		dxSetBlendMode("blend")
    		
    		local zeroX = 1314
    		local zeroY = 1322
    		
    		local mapX = x + zeroX + 15
    		local mapY = y + zeroY
    		
    		local zoneX, zoneY, zoneZ = getElementPosition(localPlayer)
    		
    		if isElementOutSide(localPlayer) then
    			dxDrawImageSection(0, 0, hud.wiel, hud.wiel, mapX, mapY, hud.wiel, hud.wiel, pliki.mapa, 0, 0, 0, tocolor(255, 255, 255, hud.przez))
    		else
    			dxDrawImageSection(0, 0, hud.wiel, hud.wiel, mapX, mapY, hud.wiel, hud.wiel, pliki.int, 0, 0, 0, tocolor(255, 255, 255, hud.przez), "nil")
    		end
    		
    		if deweloper[3] then
    			outputChatBox(tostring(getElementInterior(localPlayer)))
    		end
    		
    		dxDrawImage(hud.szer / 2, hud.szer / 2, 20, 20, pliki.gracz, 180 + rz, 0, 0, tocolor(255, 255, 255, hud.przez))
    		
    		dxSetRenderTarget(full, false)
    		if hud.rot then
    			dxDrawImage(1, h - hud.szer - 1, hud.szer, hud.szer, minimap, rz)
    		else
    			dxDrawImage(1, h - hud.szer - 1, hud.szer, hud.szer, minimap)
    			dxDrawRectangle(0, h - hud.szer - 5, hud.szer + 5, 5, tocolor(0, 0, 0, hud.przez))
    			dxDrawRectangle(hud.szer, h - hud.szer, 5, hud.szer, tocolor(0, 0, 0, hud.przez))
    		end
    		dxSetRenderTarget()
    		
    		dxDrawImage(0, h - hud.szer, hud.szer + 5, hud.szer + 5, full)
    		
    		dxDrawRectangle(0, h - hud.szer, 170, 20, tocolor(0, 0, 0, hud.przez))
    		
    		if isElementOutSide(localPlayer) then
    			dxDrawText(getZoneName(zoneX, zoneY, zoneZ), 5, h - hud.szer + 2, 0, 0, tocolor(255, 255, 255, hud.przez), 1.0, 1.0, "default"--[[, "left", "top", false, false, false, false, false, rz]])
    		else
    			dxDrawText("Interior number " .. tostring(getElementInterior(localPlayer)), 5, h - hud.szer, 0, 0, tocolor(255, 255, 0, hud.przez), 1.0, 1.0, "default-bold"--[[, "left", "top", false, false, false, false, false, rz]])
    		end
    		
    		dxSetTextureEdge(minimap, "border", tocolor(0, 0, 0, hud.przez))
    	end
    end)
    
    bindKey("n", "down", function()
    	if isPlayerHudComponentVisible("radar") then
    		setPlayerHudComponentVisible("radar", false)
    		ustawienia.dispHud = true
    	else
    		setPlayerHudComponentVisible("radar", true)
    		ustawienia.dispHud = false
    	end
    end)

    Output is nothing.

  12. I mean, how do I can show exact image section, that player is standing on in the real world now, using dxDrawImageSection()?

    Like, when mini map is in size of 3000px by 3000px, how to show exact same pos, that local player is on?

    I tried a lot with:

    local x, y = getElementPosition(localPlayer)
    local x = (x * hud.width) / 3000
    local y = (y * hud.height) / 3000
    --Rest of code

    or

    hud.units = 3000 / 6000
    
    local x, y = getElementPosition(localPlayer)
    local x = x * hud.units
    local y = y * hud.units
    
    --Rest of code

    (I even tried with just):

    lo

    local x, y = getElementPosition(localPlayer)
    --Rest of code

    But I guess, that I'm showing w r o n g image section. How can I fix it, or make it better?

    I tried to understand others' code, but I couldn't. So, I'm writing my, but still, I need some help. So how can I fix something?

    BTW, if someone want to see full code, please, visit here: [click, Code v2].

    And if you will manage something, please, share it with me, I want to learn how to do something correctly.

×
×
  • Create New...