Jump to content

Dx headstar :v


Best-Killer

Recommended Posts

Hello guys i wanted to make like this script : https://community.multitheftauto.com/index.php?p=resources&s=details&id=6729

but with DxDrawImage :D  

i want know how to drawimage too all who have stars players :v and cops can see the image too (means server side as i think )

i tried with 

 

function imagedraw() 
    local px, py, pz, tx, ty, tz, dist 
    px, py, pz = getCameraMatrix() 
    for k, v in ipairs(getElementsByType("player")) do 
        if(getElementData(v, "tesssss") == true) then 
            tx, ty, tz = getElementPosition(v) 
            dist = getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) 
            if dist < 30.0 then 
                if isLineOfSightClear(px, py, pz, tx, ty, tz, true, false, false, true, false, false, true) then 
                    local sx, sy, sz = getPedBonePosition(v, 5) 
                    local x,y = getScreenFromWorldPosition(sx, sy, sz+0.3) 
                    if ( x >= 0 and x <= 1 and y >= 0 and y <= 1 ) then 
                        x, y = AbsoluteToRelativ( x, y ) 
                        dxDrawImage ( x, y, 50, 50, "images/rank_law.png" )
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler("onClientRender",getRootElement(),imagedraw) 

 

        if ( getPlayerWantedLevel ( v ) > 0 ) then
		    setElementData ( v, "tesssss",true)
			setPlayerNametagText ( v, tostring ( getPlayerName ( v ) ).."["..tostring ( getPlayerWantedLevel ( v ) ).."]" )
		else
			setPlayerNametagText ( v, tostring ( getPlayerName ( v ) ) )
            setElementData ( v, "tesssss",false)
		end

 

Edited by Best-Killer
adding code
Link to comment

 

 

function imagedraw()
    local streamedPlayers = getElementsByType ("player", root, true)
    if streamedPlayers and #streamedPlayers ~= 0 then
        local lpos = {getElementPosition(localPlayer)}
        for _,p in ipairs (streamedPlayers) do
            if p and isElement (p) then
                if getElementData (p, "tesssss") then
                    local ppos = {getElementPosition(p)}
                    if getDistanceBetweenPoints2D (lpos[1], lpos[2], ppos[1], ppos[2]) <= 20 then
                        local x, y = getScreenFromWorldPosition (ppos[1], ppos[2], ppos[3])
                        if x and y then
                            dxDrawImage ( x, y, 50, 50, "images/crosshair.png" )
                        end
                    end
                end
            end
        end
    end
end
addEventHandler ("onClientRender", root, imagedraw)

the image showen but it's not up head the player, what i have to do now :/ 

Edited by Best-Killer
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...