Jump to content

[Help] Teammates (sorry for double post)


Recommended Posts

Hello,

 

How do I make only a member of my gang see me?

 

function showTeam()
for _, team in ipairs(getElementsByType("player"))do
            if getElementData(team, "gang") ~= "none" then 
            if team ~= getLocalPlayer() then
            if getElementData(team, "gang") == getElementData(getLocalPlayer(), "gang") then
                    
        local x,y,z = getElementPosition(team)
        local cx,cy,cz = getElementPosition(getLocalPlayer())
        if getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) <= 300 then
            sX, sY, sZ = getScreenFromWorldPosition(x,y,z)
            if(sX and sY and sZ)then
                
                local color = tocolor(50,255,50)
                size = 1
                        
                dxDrawText(string.gsub(getPlayerName(team), '#%x%x%x%x%x%x', '' ), sX+27, sY-38, 25, 20, tocolor(0,0,0), size,"default-bold")
                dxDrawText(math.floor(getDistanceBetweenPoints3D(x,y,z, cx,cy,cz)).." m", sX+27, sY-18, 25, 20, tocolor(0,0,0), size,"default-bold")
     --           
                dxDrawText(string.gsub(getPlayerName(team), '#%x%x%x%x%x%x', '' ), sX+25, sY-40, 25, 20, color, size,"default-bold")
                dxDrawText(math.floor(getDistanceBetweenPoints3D(x,y,z, cx,cy,cz)).." m", sX+25, sY-20, 25, 20, color, size,"default-bold")

                        end
                    end
                end
            end
        end
    end
end
addEventHandler("onClientRender", getRootElement(), showTeam)

 

Source: https://community.multitheftauto.com/index.php?p=resources&s=details&id=12640

Edited by Phelipecg
Link to comment
8 minutes ago, StormFighter said:

You make the clientside function to draw the text, make an event, trigger the event from serverside for the ppl in the gang

Sorry I did not understand. Could you write the function for me? I'm new to it, or would it be asking a lot of you?

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