Zixx7 Posted July 11, 2021 Share Posted July 11, 2021 for i,v in pairs(Config.MarkerBebedouro) do MarkerBebedouros = createMarker(v[1],v[2],v[3]-1, "cylinder", 2.5,0,0,0,255) end if isElementWithinMarker(source, MarkerBebedouros) then setElementFrozen(source, true) toggleAllControls (source, false) setElementFrozen(source, true) setPedAnimation(source, "bd_fire", "wash_up", 1, true, true, true, true) MX_TakeItem(source, item, 1,slot) Usando[source] = true itemobj[source] = createObject(1950, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil setPedAnimation(source, "bd_fire", "wash_up", 1, false, false, false, false) setElementFrozen(source, false) MX_GiveItem(source, "agua", 1, slot) setElementFrozen(source, false) toggleAllControls (source, true ) end, 5000*quantidade, 1) não da erro no debugscript mas tbm não funciona Link to comment
Other Languages Moderators androksi Posted July 11, 2021 Other Languages Moderators Share Posted July 11, 2021 Olá! Por favor, peço para que use a ferramenta Code quando for enviar códigos Lua. Link to comment
Blaack Posted July 11, 2021 Share Posted July 11, 2021 (edited) 13 hours ago, Zixx7 said: for i,v in pairs(Config.MarkerBebedouro) do MarkerBebedouros = createMarker(v[1],v[2],v[3]-1, "cylinder", 2.5,0,0,0,255) end if isElementWithinMarker(source, MarkerBebedouros) then setElementFrozen(source, true) toggleAllControls (source, false) setElementFrozen(source, true) setPedAnimation(source, "bd_fire", "wash_up", 1, true, true, true, true) MX_TakeItem(source, item, 1,slot) Usando[source] = true itemobj[source] = createObject(1950, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil setPedAnimation(source, "bd_fire", "wash_up", 1, false, false, false, false) setElementFrozen(source, false) MX_GiveItem(source, "agua", 1, slot) setElementFrozen(source, false) toggleAllControls (source, true ) end, 5000*quantidade, 1) não da erro no debugscript mas tbm não funciona local var = { markers = {}, } local Usando = {} local itemobj = {} addEventHandler("onResourceStart", resourceRoot, function (res) if res == getThisResource() then for i, v in pairs(Config.MarkerBebedouro) do var.markers[i] = createMarker(v[1], v[2], v[3]- 0.9, "cylinder", 2.5, 0, 0, 0, 255) addCommandHandler("teste", function (thePlayer) if isElementWithinMarker(thePlayer, var.markers[i]) then setElementFrozen(thePlayer, true) toggleAllControls (thePlayer, false) setElementFrozen(thePlayer, true) setPedAnimation(thePlayer, "bd_fire", "wash_up", 1, true, true, true, true) MX_TakeItem(thePlayer, item, 1,slot) Usando[thePlayer] = true itemobj[thePlayer] = createObject(1950, x, y, z) setElementDimension(itemobj[thePlayer], dim) setElementInterior(itemobj[thePlayer], int) exports.bone_attach:attachElementToBone(itemobj[thePlayer], thePlayer, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() destroyElement(itemobj[thePlayer]) itemobj[thePlayer] = nil Usando[thePlayer] = nil setPedAnimation(thePlayer, "bd_fire", "wash_up", 1, false, false, false, false) setElementFrozen(thePlayer, false) MX_GiveItem(thePlayer, "agua", 1, slot) setElementFrozen(thePlayer, false) toggleAllControls (thePlayer, true ) end, 5000*quantidade, 1) end) end end end end) Brother, quando for mandar algum código. Pode mandar completo, por favor? Edited July 11, 2021 by ~#BlackSCR 1 Link to comment
Zixx7 Posted July 11, 2021 Author Share Posted July 11, 2021 (edited) Usando = {} itemobj = {} Colheita = {} MarkerColheita = {} Platancao = {} vaso = {} planta = {} function MX_UseItem(item,quantidade,slot) local source = source local x,y,z = getElementPosition(source) local dim = getElementDimension(source) local int = getElementInterior(source) local Fome = getElementData(source, "fome") or 0 local Sede = getElementData(source, "sede") or 0 local Vida = getElementHealth(source) or 0 if MX_hasItem(source, item,quantidade) then if not Usando[source] then ------------------------------------------------------------------------------------------------------------------------------------------- if item == "agua" then if tonumber(Sede) < 100 then setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(1544, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() Usando[source] = nil destroyElement(itemobj[source]) itemobj[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, false, false, false, false) setElementData(source, "sede", tonumber(Sede)+20*quantidade) MX_GiveItem(source, "emptybottle", quantidade, slot) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem sede.") end elseif item == "emptybottle" then for i,v in pairs(Config.MarkerBebedouro) do MarkerBebedouros = createMarker(v[1],v[2],v[3]-1, "cylinder", 2.5,0,0,0,255) if isElementWithinMarker(source, MarkerBebedouros) then setElementFrozen(source, true) toggleAllControls (source, false) setElementFrozen(source, true) setPedAnimation(source, "bd_fire", "wash_up", 1, true, true, true, true) MX_TakeItem(source, item, 1,slot) Usando[source] = true itemobj[source] = createObject(1950, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil setPedAnimation(source, "bd_fire", "wash_up", 1, false, false, false, false) setElementFrozen(source, false) MX_GiveItem(source, "agua", 1, slot) setElementFrozen(source, false) toggleAllControls (source, true ) end, 5000*quantidade, 1) end end elseif item == "orange_juice" then if tonumber(Sede) < 100 then setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(1543, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.26, -0.05, 0.14, 34, 108, 4) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, false, false, false, false) setElementData(source, "sede", tonumber(Sede)+10*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem sede.") end elseif item == "drpepper" then if tonumber(Sede) < 100 then setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(1543, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.26, -0.05, 0.14, 34, 108, 4) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, false, false, false, false) setElementData(source, "sede", tonumber(Sede)+5*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem sede.") end elseif item == "cola" then if tonumber(Sede) < 100 then setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(2601, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 11, -0.01, 0.04, 0.06, 46, 110, -14) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "VENDING", "VEND_Drink2_P", 1, false, false, false, false) setElementData(source, "sede", tonumber(Sede)+5*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem sede.") end -- COMIDAS | elseif item == "hamburger" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(2703, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 12, -0.03, 0.03, 0.02, 0, 0, 0) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) setElementData(source, "fome", tonumber(Fome)+20*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "hot_dog" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+15*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "bolchips" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+5*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "donut" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+10*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "tacos" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true itemobj[source] = createObject(2769, x, y, z) setElementDimension(itemobj[source], dim) setElementInterior(itemobj[source], int) exports.bone_attach:attachElementToBone(itemobj[source], source, 12, 0.06, 0.03, 0.02, 50, 74, -88) setTimer(function() destroyElement(itemobj[source]) itemobj[source] = nil Usando[source] = nil toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) setElementData(source, "fome", tonumber(Fome)+15*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "fries" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+5*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "sanduiche" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+15*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end elseif item == "cupcake" then if tonumber(Fome) < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, quantidade,slot) Usando[source] = true setTimer(function() toggleControl(source, "fire", true) toggleControl(source, "jump", true) setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementData(source, "fome", tonumber(Fome)+10*quantidade) end,3000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você está sem fome.") end -- REMEDIOS | elseif item == "analgesic" then if tonumber(Vida) < 75 then if tonumber(Vida)+5 < 75 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, false, true, true) toggleControl(source, "fire", false) toggleControl(source, "jump", false) MX_TakeItem(source, item, 1,slot) Usando[source] = true setTimer(function() setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) toggleControl(source, "fire", true) toggleControl(source, "jump", true) Usando[source] = nil setElementHealth(source, tonumber(Vida)+6) end,1500,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você precisa está um pouco pior.") end else triggerClientEvent(source, "MX:Notify",source,"error", "Você não está ferido.") end elseif item == "bandage" then if tonumber(Vida) < 100 then if tonumber(Vida)+25*quantidade < 100 then setPedAnimation(source, "FOOD", "EAT_Burger", 1, true, true, true, true) MX_TakeItem(source, item, 1,slot) Usando[source] = true setTimer(function() setPedAnimation(source, "FOOD", "EAT_Burger", 1, false, false, false, false) Usando[source] = nil setElementHealth(source, tonumber(Vida)+25) end,5000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você precisa está um pouco pior.") end else triggerClientEvent(source, "MX:Notify",source,"error", "Você não está ferido.") end elseif item == "mkiteme" then if tonumber(Vida) < 101 then setPedAnimation(source, "BOMBER", "BOM_Plant", 1, true, true, true, true) MX_TakeItem(source, item, 1,slot) Usando[source] = true setTimer(function() setPedAnimation(source, "BOMBER", "BOM_Plant", 1, false, false, false, false) Usando[source] = nil setElementHealth(source, 100) end,10000,1) else triggerClientEvent(source, "MX:Notify",source,"error", "Você não está ferido.") end -- MOCHILAS | elseif item == "mochilap" then triggerEvent("MX_MochilaP",source, item, slot) elseif item == "mochilam" then triggerEvent("MX_MochilaM",source, item, slot) elseif item == "mochilag" then triggerEvent("MX_MochilaG",source, item, slot) elseif item == "mochilax" then triggerEvent("MX_MochilaX",source, item, slot) ------------------------------------------------------------------------------------------------------------------------------------------- end else triggerClientEvent(source, "MX:Notify",source,"error", "Aguarde Para Usar Outro Item.") end else triggerClientEvent(source, "MX:Notify",source,"error", "Você Não Tem Essa Quantidade.") end end addEvent("MX.UseItem",true) addEventHandler("MX.UseItem",root,MX_UseItem) addCommandHandler("colhetar", function(source) if MarkerColheita[source] == nil then return false else if MarkerColheita[source] == MarkerColheita[source] then if isElementWithinMarker(source, MarkerColheita[source]) then if Colheita[source] == true then setElementFrozen(source, true) toggleAllControls(source, false) setPedAnimation(source, "bd_fire", "wash_up", 1, true, true, true, true) setTimer(function() setPedAnimation(source, "bd_fire", "wash_up", 1, false, false, false, false) triggerClientEvent(source, "MX:Notify",source,"success", "Você colheu 1x Maconha...") destroyElement(planta[source]) destroyElement(vaso[source]) destroyElement(MarkerColheita[source]) MX_GiveItem(source, "weed", 1,slot) Platancao[source] = nil Colheita[source] = nil setElementFrozen(source, false) toggleAllControls(source, true) end,5000,1) end else return false end end end end) addCommandHandler("fs", function(source) local Fome = getElementData(source, "fome") or 0 local Sede = getElementData(source, "sede") or 0 triggerClientEvent(source, "MX:Notify",source,"success", "Fome: "..tonumber(Fome).." / Sede: "..tonumber(Sede)) end) Linha 51 a 81 Edited July 11, 2021 by Zixx7 Link to comment
Blaack Posted July 11, 2021 Share Posted July 11, 2021 2 hours ago, ~#BlackSCR said: local var = { markers = {}, } local Usando = {} local itemobj = {} addEventHandler("onResourceStart", resourceRoot, function (res) if res == getThisResource() then for i, v in pairs(Config.MarkerBebedouro) do var.markers[i] = createMarker(v[1], v[2], v[3]- 0.9, "cylinder", 2.5, 0, 0, 0, 255) addCommandHandler("teste", function (thePlayer) if isElementWithinMarker(thePlayer, var.markers[i]) then setElementFrozen(thePlayer, true) toggleAllControls (thePlayer, false) setElementFrozen(thePlayer, true) setPedAnimation(thePlayer, "bd_fire", "wash_up", 1, true, true, true, true) MX_TakeItem(thePlayer, item, 1,slot) Usando[thePlayer] = true itemobj[thePlayer] = createObject(1950, x, y, z) setElementDimension(itemobj[thePlayer], dim) setElementInterior(itemobj[thePlayer], int) exports.bone_attach:attachElementToBone(itemobj[thePlayer], thePlayer, 11, -0.10, 0.06, 0.14, -2, 90,-15) setTimer(function() destroyElement(itemobj[thePlayer]) itemobj[thePlayer] = nil Usando[thePlayer] = nil setPedAnimation(thePlayer, "bd_fire", "wash_up", 1, false, false, false, false) setElementFrozen(thePlayer, false) MX_GiveItem(thePlayer, "agua", 1, slot) setElementFrozen(thePlayer, false) toggleAllControls (thePlayer, true ) end, 5000*quantidade, 1) end) end end end end) Brother, quando for mandar algum código. Pode mandar completo, por favor? Voce testou essa solução que mandei? Link to comment
Zixx7 Posted July 11, 2021 Author Share Posted July 11, 2021 2 hours ago, ~#BlackSCR said: Voce testou essa solução que mandei? Não entendi muito bem, nem tentei 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