Jump to content

Abseil problem


dewu

Recommended Posts

Hi guys. I have strange warning with latest version of abseil:

Warning: abseil\main_client.lua:101: Bad Argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got boolean] 

Function:

function render() 
    tick = tick or getTickCount() 
    local nowtick = getTickCount() 
    for i,v in ipairs(getElementsByType("player")) do 
        local data = getElementData(v,"abseiling") 
        if data ~= "" then 
            local ped = getElementData(v,"abseilped") 
            local veh = getPedOccupiedVehicle(ped) 
            if tonumber(data) == 0 or tonumber(data) == 2 then 
                setPedRotation(v,getPedRotation(ped)+90) 
            elseif tonumber(data) == 1 or tonumber(data) == 3 then 
                setPedRotation(v,getPedRotation(ped)-90) 
            elseif data == "true" then 
                local x,y,z = getElementPosition(v) 
                local b1x,b1y,b1z = getPedBonePosition(v,36) 
                local b2x,b2y,b2z = getPedBonePosition(v,25) 
                local z3 = getGroundPosition(b2x,b2y,b2z) 
                local px4,py4,pz4 = getElementPosition(ped) 
                 
                dxDrawLine3D(b1x,b1y,b1z,px4,py4,pz4,tocolor(0,0,0,255),2,false,0) 
                dxDrawLine3D(b1x,b1y,b1z,b2x,b2y,b2z,tocolor(0,0,0,255),2,false,0) 
                dxDrawLine3D(b2x,b2y,b2z,b2x,b2y,z3,tocolor(0,0,0,255),2,false,0) 
                 
                if not isPedOnGround(v) and not (isElementInWater(v) or testLineAgainstWater(x,y,z+1,x,y,z-1)) then 
                    if v == localplayer then 
                        local _,_,vvelz = getElementVelocity(veh) 
                        local vx,vy,_ = getElementPosition(getElementData(v,"abseilped")) 
                        local px,py,_ = getElementPosition(v) 
                        local sx,sy = 0.1*(vx-px),0.1*(vy-py) 
                         
                        local speed = tonumber(getElementData(v,"abseilspeed")) 
                         
                        if getControlState("forwards") and not getControlState("backwards") then 
                            speed = speed - (getTickCount()-tick)*0.0005 
                            if speed < -0.4 then 
                                speed = -0.4 
                            end 
                        elseif getControlState("backwards") and not getControlState("forwards") then 
                            speed = speed + (getTickCount()-tick)*0.0005 
                            if speed > -0.1 then 
                                speed = -0.1 
                            end 
                        end 
                         
                        setElementData(v,"abseilspeed",speed) 
                         
                        setElementVelocity(v,sx,sy,speed+vvelz) 
                    end 
                else 
                    setElementData(v,"abseiling","") 
                    setElementData(v,"abseilped","") 
                    setElementData(v,"abseilspeed",-0.25) 
                     
                    setPedAnimation(v) 
                    removeEventHandler("onClientPlayerWasted",v,deathAnim) 
                    if v == localplayer then 
                        triggerServerEvent("doForceStopAbseiling",v,ped) 
                    else 
                        setElementCollidableWith(v,veh,true) 
                        setElementCollidableWith(v,ped,true) 
                         
                        removeEventHandler("onClientPlayerDamage",v,cancelDamage) 
                    end 
                end 
            end 
        end 
    end 
    for i,v in ipairs(vehiclesToWatch) do 
        if isElement(v) then 
            local x,y,z = getElementPosition(v) 
            local gz = getGroundPosition(x,y,z) 
            if gz then 
                if z - gz <= 2 then 
                    triggerServerEvent("doRemovePilotDummy",v) 
                    table.remove(vehiclesToWatch,i) 
                end 
            end 
        else 
            table.remove(vehiclesToWatch,i) 
        end 
    end 
    tick = nowtick 
end 
addEventHandler("onClientRender",getRootElement(),render) 

Line 101:

getPedOccupiedVehicle(ped)  

That make my server little laggy, so i really want to know the reason.

Abseil link: https://community.multitheftauto.com/in ... ls&id=1873

Link to comment

@NearGreen Do you even know what the script does?

A simple isElement check will suppress the warning, not sure whether the script will function correctly then or not. Before the warning line:

if (not isElement (ped)) then return end  

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