Jump to content

getPlayersInTeam (Bad Argument)


.:HyPeX:.

Recommended Posts

Nothing much, a radar function i'm looking at and trying to make to only own team.

  
addEventHandler("onClientRender", getRootElement(),  
function() 
    showPlayerHudComponent("radar", false) 
    local px, py, pz = getElementPosition(lp) 
    local pr = getPedRotation(lp) 
    local cx,cy,_,tx,ty = getCameraMatrix() 
    local north = findRotation(cx,cy,tx,ty) 
    dxDrawImage(posx,posy,height,height, "img/radar.png") 
    dxDrawImage(posx,posy,height,height, "img/north.png", north) 
    for id, player in ipairs(getPlayersInTeam(getPlayerTeam(getLocalPlayer()))) do 
    if player ~= lp then 
        local _,_,rot = getElementRotation(player) 
        local ex, ey, ez = getElementPosition(player) 
            local dist = getDistanceBetweenPoints2D(px,py,ex,ey) 
            if dist > range then 
                dist = tonumber(range) 
            end 
            local angle = 180-north + findRotation(px,py,ex,ey) 
            local cblipx, cblipy = getDistanceRotation(0, 0, height*(dist/range)/2, angle) 
            local blipx = centerleft+cblipx-blipsize/2 
            local blipy = centertop+cblipy-blipsize/2 
            local yoff = 0 
            local r,g,b,a = 255,255,255,255 
            if getPlayerTeam(player) then 
                r,g,b = getTeamColor( getPlayerTeam(player) ) 
            end 
            local img = "img/blip.png" 
            if (ez - pz) >= 5 then 
                img = "img/blipup.png" 
            elseif (ez - pz) <= -5 then 
                img = "img/blipdown.png" 
            end 
            dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) 
        end 
    end 
    dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr) 
end 
) 

Pd:

  
local lp = getLocalPlayer() 

Pd2: Debug:

Error in line: Bad Argument @getPlayersInTeam

Error in line: bad argument to #1 ipairs (table expected, got boolean)

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