Jump to content

Sasu

MTA Contributors
  • Posts

    1,056
  • Joined

  • Last visited

Posts posted by Sasu

  1. Hey there!

    I have a problem getting value of a node. Here is the xml and script that I have:

    <div> 
        <span class="title"><strong>Alan Walker</strong> – Faded (Amice Remix)</span> <em>(4:34)</em> 
    </div> 
    

    local node = xmlNodeGetChildren(xml, 0) 
    if xmlNodeGetName(node) == "span" then 
        songName = xmlNodeGetValue(node) 
        outputChatBox(tostring(songName)) 
        artist = xmlNodeGetValue(xmlNodeGetChildren(node, 0)) 
    end 
    

    It returns the artist(inside node) correctly but for some reason the song name is not returned anything. I think '–' might have something to do with.

    Hope you can help me guys, thanks.

  2. If you still need it, I made a custom one using as base a code by ZoRRoM^ and this other code from gta forums(http://gtaforums.com/topic/835347-rotating-camera/?p=1068327127).

    local rotX, rotY, rotRadius, maxRadius = 0, -math.pi/2, 10, 20 
    local isCustomCamera = false 
    local cameraTarget = nil 
    local sX, sY = guiGetScreenSize() 
      
    addEventHandler("onClientPreRender", root, 
        function() 
            if isCustomCamera and isElement(cameraTarget) then 
      
                local x, y, z = getElementPosition( cameraTarget ) 
                local cx, cy, cz 
                 
                cx = x + rotRadius * math.sin(rotY) * math.cos(rotX) 
                cy = y + rotRadius * math.sin(rotY) * math.sin(rotX) 
                cz = z + rotRadius * math.cos(rotY) 
                 
                local hit, hitX, hitY, hitZ = processLineOfSight(x, y, z, cx, cy, cz, _, false, _, _, _, _, _, _, cameraTarget) 
                if hit then 
                    cx, cy, cz = hitX, hitY, hitZ 
                end 
      
                setCameraMatrix( cx, cy, cz, x, y, z ) 
            end 
        end 
    ) 
      
    addEventHandler("onClientKey", root, 
        function(button) 
            if button == "mouse_wheel_up" then 
                rotRadius = math.max(2, rotRadius - 1) 
            elseif button == "mouse_wheel_down" then 
                rotRadius = math.min(maxRadius, rotRadius + 1) 
            end 
        end 
    ) 
      
    addEventHandler("onClientCursorMove", root, 
        function(cX,cY,aX,aY) 
            if isCursorShowing() or isMTAWindowActive() then return end 
                     
            aX = aX - sX/2  
            aY = aY - sY/2 
      
            rotX = rotX - aX * 0.01745 * 0.3 
            rotY = math.min(-0.02, math.max( rotY + aY * 0.01745 * 0.3, -3.11 ) ) 
             
        end 
    ) 
      
    function setCustomCameraTarget(element) 
        if isElement(element) then 
            cameraTarget = element 
            isCustomCamera = true 
            return true 
        else 
            cameraTarget = nil 
            isCustomCamera = false 
        end 
    end 
    

    Use setCustomCameraTarget function, for example:

    setCustomCameraTarget(localPlayer) 
    

  3. Try this:

    dxDrawImageSection(screenW * 0.6340, screenH * 0.0130, screenW *  0.3551, screenH * 0.5534, 0, 0, (getElementHealth(localPlayer)*425)/100, 425, ":DayZ/images/health.png", 0, 0, 0, tocolor(r, g, b, 170), false) 
    

×
×
  • Create New...