Jump to content

dxdraw problem


yoya99

Recommended Posts

Posted

another question how can i make it be shown not only my own also the images of the other players.....hellpppp pls

i used that code here:

  
local sx,sy = guiGetScreenSize() 
function showImage() 
if getElementData(getLocalPlayer(), "showImage") then 
dxDrawImage((sx-190)/2, (sy-200)/2, 25, 25, "classicon_player.png" ) 
else 
dxDrawImage((sx-190)/2, (sy-200)/2, 25, 25, "classicon_vip.png" ) 
end 
end 
addEventHandler("onClientRender", root, showImage) 

function setDataOnLogin() 
     if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount( source )),aclGetGroup ( "Admin" )) then 
        setElementData(source, "showImage", true) 
    end 
end 
addEventHandler("onPlayerLogin", root, setDataOnLogin) 
  
function setDataOnResourceStart() 
    for i, v in ipairs(getElementsByType("player")) do 
     if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount ( v )), aclGetGroup ( "Admin" )) then 
            setElementData(v, "showImage", true) 
        end 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, setDataOnResourceStart) 
  
function removeDataOnLogout() 
        setElementData(source, "showImage", false) 
end 
addEventHandler("onPlayerLogout", root, removeDataOnLogout) 

And the snail starts to sing

Posted

left of the palyers head yes.....but i want to show the images from other players too.....so i wantto show my own and the images from others

And the snail starts to sing

Posted (edited)

try this:

addEventHandler( 'onClientRender', root, 
function()                   
for _, player in ipairs( getElementsByType( 'player') ) do 
    if isElementOnScreen( player ) and getElementData( player, 'showImage' ) then 
        local cx, cy, cz = getCameraMatrix() 
        local vx, vy, vz = getPedBonePosition( player, 8 ) 
        local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz ) 
        local drawDistance = 70.0 
        local target = getPedTarget(localPlayer) 
        if dist < drawDistance or player == target then 
            if( isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) ) then 
                x, y = getScreenFromWorldPosition (vx, vy, vz + 0.3) 
                    if(x and y) then 
                        dxDrawImage(x, y, x + 20, y + 20, "classicon_player.png" ) 
                    end 
                end 
            end 
        end 
    end 
end) 

Copy the code again

Edited by Guest
jIcd9sc.png

Not worry about the future. Very soon it will come.

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...