.:HyPeX:. Posted March 25, 2014 Posted March 25, 2014 Help guys, what i'm doing wrong? for id, player in ipairs(getPlayersInTeam(getPlayerTeam(getLocalPlayer()))) do
Alexs Posted March 26, 2014 Posted March 26, 2014 Is the script client-side? Yes. Debug message? Can you show us the full code?
xXMADEXx Posted March 26, 2014 Posted March 26, 2014 There's nothing wrong with that loop... Maybe something that's inside of it?
.:HyPeX:. Posted March 26, 2014 Author Posted March 26, 2014 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)
.:HyPeX:. Posted March 26, 2014 Author Posted March 26, 2014 EDIT: Found the problem, it wasnt actually one, it was just during joining becouse i wasnt assigned to any team (:L)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now