dewu Posted February 19, 2015 Posted February 19, 2015 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
Enargy, Posted February 22, 2015 Posted February 22, 2015 try using getLocalPlayer() instead of Ped - Inactivo.
JR10 Posted February 22, 2015 Posted February 22, 2015 @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 Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
nxFairlywell Posted February 22, 2015 Posted February 22, 2015 getPedOccupiedVehicle( ped ) > get a data you have variable ' ped ' = getElementData ! this big problem , you want get ped to getPedOccupiedVehicle check wiki function getPedOccupiedVehicle page syntax . Discord ID : nxFairlywell#6895
JR10 Posted February 22, 2015 Posted February 22, 2015 Not really, elements can be stored in element data. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
nxFairlywell Posted February 22, 2015 Posted February 22, 2015 Not really, elements can be stored in element data. if inserting elements into a data but, if not insert elements into a data ; you can't get elements from data . . Discord ID : nxFairlywell#6895
JR10 Posted February 23, 2015 Posted February 23, 2015 I think you mean that he didn't use setElementData first? If so, then no he actually did. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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