WeeD1 Posted March 16, 2019 Share Posted March 16, 2019 Olá galerinha, estou com um problema em um mod de contagem de drift, em alguns momentos após o veículo ser destruído ele aparece isso: WARNING: Contador\drift_c.lua:58: Bad argument @ 'getVehicleHandling' [Expected vehicle at argument 1] ERROR: Contador\drift_c.lua:58: attempt to index a boolean value Alguém que possa me ajudar nisso? local function checkVehicleHandling() local flags = getVehicleHandling(vehicle)["handlingFlags"] if (bitAnd( flags, 32 ) == 32) or (bitAnd( flags, 64 ) == 64) then return true end end Link to comment
[M]ister Posted March 16, 2019 Share Posted March 16, 2019 local function checkVehicleHandling() if not isElement(vehicle) then return end local flags = getVehicleHandling(vehicle)["handlingFlags"] if (bitAnd( flags, 32 ) == 32) or (bitAnd( flags, 64 ) == 64) then return true end end 1 1 Link to comment
WeeD1 Posted March 16, 2019 Author Share Posted March 16, 2019 (edited) Opa, valeu @MaligNos. Porém agora ele está acusando outro erro, ao que eu entendi ele não está removendo o evento após ser destruído, o que eu poderia fazer pra resolver isso? WARNING: Contador\drift_c.lua:6: Bad argument @ 'removeEventHandler' [Expected element at argument 2] WARNING: Contador\drift_c.lua:7: Bad argument @ 'removeEventHandler' [Expected element at argument 2] local function drawMeter () if isWorldSpecialPropertyEnabled("hovercars") then return end if checkVehicleHandling() then return end if localPlayer.vehicle ~= vehicle then removeEventHandler("onClientVehicleDamage",vehicle,onCollide) removeEventHandler("onClientElementDestroy",vehicle,checkVehicle) removeEventHandler("onClientPlayerWasted",localPlayer,checkVehicle) removeEventHandler("onClientRender",root,drawMeter) removeEventHandler("onClientPreRender", root, updateFPS) vehicle=nil inVehicle=false checkVehicle() return end Edited March 16, 2019 by WeeD1 Link to comment
[M]ister Posted March 16, 2019 Share Posted March 16, 2019 Adicione aquela mesma verificação na linha 4 desse outro. 1 1 Link to comment
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