Jump to content

Spectating error


P[ow]er

Recommended Posts

hi i have a question when a player watching me i see who is whatching me but when i watch other player he is too see know who watch himself but i cant see who watching him and nothing in debug

anyone can help me ?

 

this is race_client.lua

setTimer(
function()
	--Specs
	local snr = 0
	for k, v in ipairs(getElementsByType("player")) do
		local label = getPlayerNametagText(v)
		if getElementData(v, 'spectates') == getLocalPlayer() then
			snr = snr + 1
			if posLabel[label] ~= nil then
				setElementData(posLabel[label], "spectated", true)
				setElementData(playerLabel[label], "spectated", true)
			end
		else
			if posLabel[label] ~= nil then
				setElementData(posLabel[label], "spectated", false)
				setElementData(playerLabel[label], "spectated", false)
			end
		end
	end
end
,50,0)

 

 

and this rankingboard_client.lua

addEventHandler("onClientRender", getRootElement(), 
function()
    for id, elem in pairs(playerLabel) do
        if guiGetVisible(elem) and string.len(guiGetText(elem)) > 4 then
            local x,y = guiGetPosition(elem, false)
            local a = guiGetAlpha(elem) * 255
                if not getKeyState("tab") then
                dxDrawColoredLabel(string.gsub(guiGetText(elem)," ", " ",1), 65,y,200,y+17, tocolor(255,255,255,a),{255,255,255,a},1, font, "left", "center", false,false,false)                
                if getElementData(playerLabel[id], "spectated") ~= nil then
                    if getElementData(playerLabel[id], "spectated") then
                        dxDrawImage(17,y,16,16,"img/eye.png", 0,0,0,tocolor(255,255,255,255), false)
                    end
                end
            end
            if x < 100 then guiSetPosition(elem, sx+100,y,false) end
        end
    end
    for id, elem in pairs(posLabel) do
        if guiGetVisible(elem) and string.len(guiGetText(elem)) <= 4 then
            local x,y = guiGetPosition(elem, false )
            local a = guiGetAlpha(elem) * 255
            if not getKeyState("tab") then
                if getElementData(posLabel[id],"spectated") == true then
                    dxDrawText(guiGetText(elem), 1,y+1,56,y+18, tocolor(0,0,0,math.floor(a*0.8)), 1, font, "right", "center", false,false,false)
                    dxDrawText(guiGetText(elem), 0,y,55,y+17, tocolor(127,255,212,a), 1, font, "right", "center", false,false,false)
                else
                    dxDrawText(guiGetText(elem), 1,y+1,56,y+18, tocolor(0,0,0,math.floor(a*0.8)), 1, font, "right", "center", false,false,false)
                    dxDrawText(guiGetText(elem), 0,y,55,y+17, tocolor(255,255,255,a), 1, font, "right", "center", false,false,false)
                end
            end
            if x < 100 then guiSetPosition(elem, sx+100,y,false) end
        end
    end
end)

 

Link to comment

You should try to fix it, on your OWN and if you are stuck somewhere, we'll help ya. We won't make you the whole script if you don't even try. Downloading scripts and asking the community to edit it for you is not called scripting at all.

  • Thanks 1
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...