PashaBiceps Posted January 24, 2021 Share Posted January 24, 2021 (edited) Olá boa tarde! Gostaria de solicitar ajuda para o seguinte erro. ( Attempt to perform Arithmetic on field '?' a nil value). Ás vezes funciona, outras vezes dá esse erro! O que poderá ser? Agradeço a ajuda desde já. function Entregar_Caixas (source) local Emprego = getElementData ( source, "Emprego" ) local Occupied_Veh = getPedOccupiedVehicle(source) local Cargas = tonumber(getElementData(source, "DNL:Cargas")) or 0 local Random_Pos = math.random ( #Marker_Aleatorios ) if isPedInVehicle ( source ) then if (getElementModel (Occupied_Veh) == 413) then if Cargas >= 1 then if Emprego == "Carteiro" then if getElementData ( source, "Entrega_Acionada" ) == false then if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end setElementData(source, "Entrega_Acionada", true) Linha do ERRO ---> Marker_Entregar[source] = createMarker ( Marker_Aleatorios[Random_Pos][1], Marker_Aleatorios[Random_Pos][2], Marker_Aleatorios[Random_Pos][3] -1, "cylinder", 2, 255 ,255 ,255, 50) Blip_Entregar[source] = createBlipAttachedTo( Marker_Entregar[source], 0 ) setElementVisibleTo ( Marker_Entregar[source], root, false ) setElementVisibleTo ( Marker_Entregar[source], source, true ) setElementVisibleTo ( Blip_Entregar[source], root, false ) setElementVisibleTo ( Blip_Entregar[source], source, true ) addEventHandler("onMarkerHit", Marker_Entregar[source], Entregar_Caixa_Casa) exports.YM_DxMessages:addBox(source, "Entregue todas as caixas que pegou no correio!", "info") else exports.YM_DxMessages:addBox(source, "Você já está em uma rota, entregue todas primeiro!", "warning") end else exports.YM_DxMessages:addBox(source, "Apenas funcionários dos CTT, podem trabalhar aqui!", "warning") end else exports.YM_DxMessages:addBox(source, "Você não tem caixas para entregar!", "error") end end end end addCommandHandler("smt_command", Entregar_Caixas) Edited January 24, 2021 by PashaBiceps 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