Jump to content

[HELP] Please.


GrubaS

Recommended Posts

Hello,

I'm making the script for specs on deathlist :)

addEventHandler("onClientRender", root, 
    function() 
        for id, elem in pairs(playerLabel) do 
                alphaElem[elem] = alphaElem[elem] + 2 
            if alphaElem[elem] > 255 then 
                alphaElem[elem] = 255 
            elseif alphaElem[elem] < 0 then 
                alphaElem[elem] = 0 
            end 
        end 
        for id, elem in pairs(posLabel) do 
                alphaElem[elem] = alphaElem[elem] + 2 
            if alphaElem[elem] > 255 then 
                alphaElem[elem] = 255 
            elseif alphaElem[elem] < 0 then 
                alphaElem[elem] = 0 
            end 
        end 
        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 
                    if getElementData(elem,"spectated") then 
                        colorElem[elem] = {255,153,0} 
                    else 
                        colorElem[elem] = {30,30,30} 
                    end 
                          
                    dxDrawColoredLabel(string.gsub(guiGetText(elem)," ", " #ffffff",1), 50,y,200,y+20, tocolor(255,255,255,alphaElem[elem]),{Cr,Cg,Cb,alphaElem[elem]}, 1, font, "left", "center", false,false,false)                
                     if getElementData(elem, "spectated") then 
                         dxDrawImage(20,y,16,16,"img/eye.png", 0,0,0,tocolor(255,255,255,255), false) 
                     end 
                    local target = getCameraTarget() 
                    if target then 
                        if isElement(localPlayer) then 
                        local spectatedperson = getCameraTarget() 
                            setElementData(localPlayer,"dlspec", spectatedperson) 
                            if getPedOccupiedVehicle(getElementData(source,"dlspec")) == target then 
                                dxDrawImage(20,y,16,16,"img/eye.png",tocolor(255,255,255,false)) 
                            end 
                        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(elem,"spectated") then 
                        dxDrawText(guiGetText(elem), 1,y+1,41,y+21, tocolor(0,0,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) 
                        dxDrawText(guiGetText(elem), 0,y,40,y+20, tocolor(255,69,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) 
                    else 
                        dxDrawText(guiGetText(elem), 1,y+1,41,y+21, tocolor(0,0,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) 
                        dxDrawText(guiGetText(elem), 0,y,40,y+20, tocolor(255,255,255,alphaElem[elem]), 1, font, "right", "center", false,false,false) 
                    end 
                end 
                if x < 100 then guiSetPosition(elem, sx+100,y,false) end 
                end 
            end 
        end 
) 
  

+

setTimer( 
function () 
local spectatedperson = getCameraTarget() 
setElementData(localPlayer,"dlspec", spectatedperson) 
end, 500,0) 

debugscript 3:

if getPedOccupiedVehicle(getElementData(source,"dlspec")) == target then 

(Expected ped at argument 1, got vehicle)

Link to comment
getPedOccupiedVehicle 

First argument must consist of a player variable, not element data.

element-data can return anything whether it's a string, boolean, vehicle, etc...

The problem is the element-data is returning a vehicle when you want it to return a ped.

Try using this:

if (  
     type ( getElementData(source,"dlspec") ) == "userdata"  
     and getElementType ( getElementData(source,"dlspec") ) == "vehicle"  
     and getVehicleController ( getElementData(source,"dlspec") ) == target  
) then 

Link to comment
getPedOccupiedVehicle 

First argument must consist of a player variable, not element data.

element-data can return anything whether it's a string, boolean, vehicle, etc...

The problem is the element-data is returning a vehicle when you want it to return a ped.

Try using this:

if (  
     type ( getElementData(source,"dlspec") ) == "userdata"  
     and getElementType ( getElementData(source,"dlspec") ) == "vehicle"  
     and getVehicleController ( getElementData(source,"dlspec") ) == target  
) then 

now in debugscript 3:

race_client: 349, attempt to perform arihmetic on blobal 'g_PickupStartTick'(a nil value) 

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