Wananazo Posted June 28, 2022 Share Posted June 28, 2022 (edited) hello good afternoon day or night I took the audacity to write to the private because I have a doubt with this structure I have made some basic script that I have been accommodating little by little in trial and error but this one seemed complicated I don't know what is failing in I am making this function an object that is dragged to the vehicle, lock the door and unlock, that is, a car key, but it is not working for me and it does not give me an error either, and that has me in doubt (It is a single question that I will ask, do not worry, I will not be bothering the private person, if I have doubts, I will post it in the forum) SERVER SIDE: elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then --the item to activate is in Spanish is the name of the key for vehicles if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then local veiculo = getElementData(playerSource, "Vehicle:Owner") if veiculo then if getElementData(veiculo, "Player:Owner") == source then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then if not getElementData(clickedWorld, "engine") then local trancar = getElementData(clickedWorld, "Vehicle:Owner") outputChatBox(" ", source) outputChatBox("• Veículo destrancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) end end end end else setElementData(veiculo, "Locked", true) outputChatBox(" ", source) outputChatBox("• Veículo trancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(players) local ex, ey, ez = getElementPosition(veiculo) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setTimer(triggerClientEvent, 600, 1, players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) setTimer(setVehicleOverrideLights, 600, 1, veiculo, 2) setTimer(setVehicleOverrideLights, 900, 1, veiculo, 1) end end end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end end end Edited June 28, 2022 by Citizen code blocks Link to comment
Moderators Citizen Posted June 28, 2022 Moderators Share Posted June 28, 2022 Hello @Wananazo, Your topic is not a tutorial so it has been moved to the Scripting Section. Tutorials section is only meant for tutorials. Make sure to post your next topic to this section when asking for help with scripts. Also make sure to paste code in code blocks (I edited your post to fix that) Best regards, Link to comment
AngelAlpha Posted June 29, 2022 Share Posted June 29, 2022 On 28/06/2022 at 19:48, Wananazo said: hello good afternoon day or night I took the audacity to write to the private because I have a doubt with this structure I have made some basic script that I have been accommodating little by little in trial and error but this one seemed complicated I don't know what is failing in I am making this function an object that is dragged to the vehicle, lock the door and unlock, that is, a car key, but it is not working for me and it does not give me an error either, and that has me in doubt (It is a single question that I will ask, do not worry, I will not be bothering the private person, if I have doubts, I will post it in the forum) SERVER SIDE: elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then --the item to activate is in Spanish is the name of the key for vehicles if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then local veiculo = getElementData(playerSource, "Vehicle:Owner") if veiculo then if getElementData(veiculo, "Player:Owner") == source then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then if not getElementData(clickedWorld, "engine") then local trancar = getElementData(clickedWorld, "Vehicle:Owner") outputChatBox(" ", source) outputChatBox("• Veículo destrancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) end end end end else setElementData(veiculo, "Locked", true) outputChatBox(" ", source) outputChatBox("• Veículo trancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(players) local ex, ey, ez = getElementPosition(veiculo) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setTimer(triggerClientEvent, 600, 1, players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) setTimer(setVehicleOverrideLights, 600, 1, veiculo, 2) setTimer(setVehicleOverrideLights, 900, 1, veiculo, 1) end end end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end end end full code please Link to comment
Wananazo Posted June 29, 2022 Author Share Posted June 29, 2022 (edited) ----------------------------------------------------------------------------------------------------------------------------------------- inventario = {} timerStart = {} gates = {} boxes = {} acao = {} item = {} arma = {} capacete = {} maleta = {} mascara = {} som = {} flor = {} tempo = {} cigarro = {} algemado = {} algemando = {} blip = {} curado = {} timerAlgema = {} bau = {} ----------------------------------------------------------------------------------------------------------------------------------------- for i, v in pairs(GatePositions) do gates[i] = createObject(GatePositions[i][2], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5], 0, 0, GatePositions[i][11]) end for i, v in pairs(BoxPositions) do boxes[i] = createObject(1227, BoxPositions[i][3], BoxPositions[i][4], BoxPositions[i][5]-0.2, BoxPositions[i][6], BoxPositions[i][7], BoxPositions[i][8]) setElementData(boxes[i], "IsBox", BoxPositions[i][1]) bau[BoxPositions[i][1]] = {} setElementInterior(boxes[i], BoxPositions[i][9]) setElementDimension(boxes[i], BoxPositions[i][10]) end ----------------------------------------------------------------------------------------------------------------------------------------- function giveItem(playerSource, commandName, id, item, qntd) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then if not qntd then return exports._infobox:addNotification(playerSource, "Utilice: /giveitem ID ITEM CANTIDAD", "error") end for i, v in pairs(getElementsByType("player")) do if getElementData(v, "ID") == tonumber(id) then if GiveAndTakeAndGetItem("give", v, item, qntd) then exports._infobox:addNotification(playerSource, "Diste "..qntd.."x '"..(realName[item][1]).."' Para el jugador "..getPlayerName(v), "success") exports._infobox:addNotification(v, "Recibiste "..qntd.."x '"..(realName[item][1]).."' del Admin "..getPlayerName(playerSource), "info") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local name2 = getPlayerName(v) local ID2 = getElementData(v, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: "..qntd.."\nOperación: Give") else exports._infobox:addNotification(playerSource, "El Jugador no tiene espacio en la mochila o dicho articulo no existe", "error") end end end end end addCommandHandler("giveitem", giveItem) ----------------------------------------------------------------------------------------------------------------------------------------- function takeItem(playerSource, commandName, id, item, qntd) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then if not id then return exports._infobox:addNotification(playerSource, "Utilice: /takeitem ID ITEM", "error") end for i, v in pairs(getElementsByType("player")) do if getElementData(v, "ID") == tonumber(id) then if (qntd) then if GiveAndTakeAndGetItem("take", v, item, tonumber(qntd)) then exports._infobox:addNotification(playerSource, "Removiste "..qntd.."x '"..(realName[item][1]).."' del inventario del jugador "..getPlayerName(v), "success") exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." removió "..qntd.."x '"..(realName[item][1]).."' de tu inventario", "warning") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local name2 = getPlayerName(v) local ID2 = getElementData(v, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: "..qntd.."\nOperación: Take") else exports._infobox:addNotification(playerSource, "El jugador no posee "..qntd.."x este item en su mochila o el item informado no existe", "error") end else if GiveAndTakeAndGetItem("take", v, item, "all") then exports._infobox:addNotification(playerSource, "Removiste todo '"..(realName[item][1]).."' del inventario del jugador "..getPlayerName(v), "success") exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." removió el item '"..(realName[item][1]).."' de tu inventario", "warning") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local name2 = getPlayerName(v) local ID2 = getElementData(v, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: All\nOperación: Take") else exports._infobox:addNotification(playerSource, "El jugador no posee este item en su mochila o el item informado no existe", "error") end end end end end end addCommandHandler("takeitem", takeItem) ----------------------------------------------------------------------------------------------------------------------------------------- function resetInv(playerSource, commandName, id) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then if not id then return exports._infobox:addNotification(playerSource, "Utilice: /takeitem ID ITEM", "error") end for i, v in pairs(getElementsByType("player")) do if getElementData(v, "ID") == tonumber(id) then for index = #inventario[v], 1, -1 do local item = inventario[v][index][1] if not itensCantRemoved[item] then GiveAndTakeAndGetItem("take", v, item, "all") end end exports._infobox:addNotification(playerSource, "Reiniciaste el Inventario del Jugador "..getPlayerName(v), "success") exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." reinicio su inventario", "warning") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local name2 = getPlayerName(v) local ID2 = getElementData(v, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nOperación: Reset") end end end end addCommandHandler("resetinv", resetInv) ----------------------------------------------------------------------------------------------------------------------------------------- function GiveAndTakeAndGetItem(tipo, playerSource, item, qntd) if realName[item] then if tipo == "give" then local peso = 0 local maxPeso = 30 for i, v in pairs(pesoItens) do for index, value in pairs(inventario[playerSource]) do if inventario[playerSource][index][1] == i then peso = peso + (pesoItens[i][1] * inventario[playerSource][index][2]) end end end if getElementData(playerSource, "ouro") then maxPeso = 30 elseif getElementData(playerSource, "platina") then maxPeso = 40 elseif getElementData(playerSource, "diamante") then maxPeso = 50 else maxPeso = 25 end if (peso + (pesoItens[item][1] * qntd)) <= maxPeso then local count = false for i, v in pairs(inventario[playerSource]) do if inventario[playerSource][i][1] == item then count = true end end if count then for i, v in pairs(inventario[playerSource]) do if inventario[playerSource][i][1] == item then inventario[playerSource][i][2] = inventario[playerSource][i][2] + tonumber(qntd) triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource]) return true end end else if #inventario[playerSource] < 30 then local edit = {item, tonumber(qntd)} table.insert(inventario[playerSource], edit) triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource]) return true else return false end end else return false end elseif tipo == "take" then for i, v in pairs(inventario[playerSource]) do if inventario[playerSource][i][1] == item then if tostring(qntd) == "all" then table.remove(inventario[playerSource], i) removeItem(playerSource, item) else if inventario[playerSource][i][2] >= tonumber(qntd) then inventario[playerSource][i][2] = inventario[playerSource][i][2] - tonumber(qntd) else return false end end if inventario[playerSource][i] then if inventario[playerSource][i][2] <= 0 then table.remove(inventario[playerSource], i) removeItem(playerSource, item) end end triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource]) return true end end elseif tipo == "get" then for i, v in pairs(inventario[playerSource]) do if inventario[playerSource][i][1] == item then if inventario[playerSource][i][2] > 0 then return inventario[playerSource][i][2] else return 0 end end end return 0 end end end function formatItens(table, type) TableItens = table if #TableItens ~= 0 then if type == "bau" then for i,v in ipairs(TableItens) do local Item = v.Item local Quantidade = v.Quantidade TableItens[i].Nome = realName[Item][1] TableItens[i].Peso = pesoItens[Item][1] end else for i,v in ipairs(TableItens) do local Item = v[1] local Quantidade = v[2] TableItens[i][3] = realName[Item][1] TableItens[i][4] = pesoItens[Item][1] end end end return TableItens end function getItensPlayer(player) return (inventario[player] and formatItens(inventario[player]) or {}) end ----------------------------------------------------------------------------------------------------------------------------------------- function use(playerSource, itemUsed) if itemUsed == "suco" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1544, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.26, -0.05, 0.14, 34, 108, 4) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(5, 10) local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + random) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "refrigerante" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2601, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setObjectScale(item[playerSource], 0.9) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(20, 35) local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + random) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "whisky" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1520, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.25, 0.01, 0.11, 44, 100, -4) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(25, 30) local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + random) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else-- exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") -- end elseif itemUsed == "leite2" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1484, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, -0.02, 0.13, 22, 132, 12) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + 50) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "redbull" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2601, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setObjectScale(item[playerSource], 0.9) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(50, 60) local sede = getElementData(playerSource, "Energy") or 0 setElementData(playerSource, "Energy", sede + random) if getElementData(playerSource, "Energy") > 100 then setElementData(playerSource, "Energy", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "monster" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2601, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setObjectScale(item[playerSource], 0.9) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(10, 15) local sede = getElementData(playerSource, "Energy") or 0 setElementData(playerSource, "Energy", sede + random) if getElementData(playerSource, "Energy") > 100 then setElementData(playerSource, "Energy", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "whisky" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1520, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.25, 0.01, 0.11, 44, 100, -4) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(25, 30) local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + random) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "leite2" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1484, x, y, z) acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) PlaySound3D(playerSource, "drink", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, -0.02, 0.13, 22, 132, 12) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local sede = getElementData(playerSource, "sede") or 0 setElementData(playerSource, "sede", sede + 50) if getElementData(playerSource, "sede") > 100 then setElementData(playerSource, "sede", 100) end end, 3000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "burrito" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2769, x, y, z) acao[playerSource] = setTimer(function() end, 5000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "FOOD", "EAT_Burger", 5000, false, true, false, false, _, true) PlaySound3D(playerSource, "eat", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, 0.06, 0.03, 0.02, 50, 74, -88) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(5, 10) local hunger = getElementData(playerSource, "hunger") or 0 local fezes = getElementData(playerSource, "fezes") or 0 setElementData(playerSource, "hunger", hunger + random) setElementData(playerSource, "fezes", fezes + random) if getElementData(playerSource, "fezes") > 100 then setElementData(playerSource, "fezes", 100) end if getElementData(playerSource, "hunger") > 100 then setElementData(playerSource, "hunger", 100) setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 100) end end, 5000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "pizza" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2702, x, y, z) acao[playerSource] = setTimer(function() end, 5000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setObjectScale(item[playerSource], 0.8) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "FOOD", "EAT_Pizza", 5000, false, true, false, false, _, true) PlaySound3D(playerSource, "eat", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -3.4694469519536e-18, 0.08, 0.05, -6, 251.5, 10) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(30, 45) local hunger = getElementData(playerSource, "hunger") or 0 local fezes = getElementData(playerSource, "fezes") or 0 setElementData(playerSource, "hunger", hunger + random) setElementData(playerSource, "fezes", fezes + random) if getElementData(playerSource, "fezes") > 100 then setElementData(playerSource, "fezes", 100) end if getElementData(playerSource, "hunger") > 100 then setElementData(playerSource, "hunger", 100) setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 150) end end, 5000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "hamburguer" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(2703, x, y, z) acao[playerSource] = setTimer(function() end, 5000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementDimension(item[playerSource], dim) setElementInterior(item[playerSource], int) setPedAnimation(playerSource, "FOOD", "EAT_Burger", 5000, false, true, false, false, _, true) PlaySound3D(playerSource, "eat", 15) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -0.02, 0.06, 0.05, -14, 8, -18) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil local random = math.random(25, 30) local hunger = getElementData(playerSource, "hunger") or 0 local fezes = getElementData(playerSource, "fezes") or 0 setElementData(playerSource, "hunger", hunger + random) setElementData(playerSource, "fezes", fezes + random) if getElementData(playerSource, "fezes") > 100 then setElementData(playerSource, "fezes", 100) end if getElementData(playerSource, "hunger") > 100 then setElementData(playerSource, "hunger", 100) setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 200) end end, 5000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "corda" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 1000) acao[playerSource] = setTimer(function() exports["[MOD]Gang"]:algemar(playerSource) end, 1000, 1) --triggerClientEvent(playerSource, "MST.Notify",playerSource, "success", "Você segurou e amarrou") end else exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5) end elseif itemUsed == "medatickets" then local moedas = getElementData(source,"moneycoins") or 0 if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end acao[playerSource] = setTimer(function() end, 3000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local random = math.random(1, 3) local moedas = getElementData(playerSource, "moneycoins") or 0 setElementData(playerSource, "moneycoins", moedas + random) exports._infobox:addNotification(playerSource, "Has intercambiado Medatickets por Medcoins a tu billetera", "success", "tienes mas "..random.." Diamantes en tu cuenta", 8) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5) end elseif itemUsed == "cartao123" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end acao[playerSource] = setTimer(function() end, 1000, 1) exports._infobox:addNotification(playerSource, "ve a PigPen no le digas a nadie (Corazón en el mapa)", "success", "", 8) end end elseif itemUsed == "vip1" then if getElementData(playerSource, "ouro") == false then if getElementData(playerSource, "platina") == false then if getElementData(playerSource, "diamante") == false then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end acao[playerSource] = setTimer(function() end, 1000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setElementData(playerSource, "ouro", true) exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo VIP ORO por 30 dias", 5) if GiveAndTakeAndGetItem("get", playerSource, "ouros1") == 0 then exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1) end end end end else exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5) end end elseif itemUsed == "vip2" then if not getElementData(playerSource, "platina") then if not getElementData(playerSource, "diamante") then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end acao[playerSource] = setTimer(function() end, 1000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setElementData(playerSource, "ouro", false) setElementData(playerSource, "platina", true) exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo Platinum VIP por 30 días", 5) if GiveAndTakeAndGetItem("get", playerSource, "platinas1" or "ouros1") == 0 then exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1) exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "platinas1", 1) end end end end else exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5) end elseif itemUsed == "vip3" then if getElementData(playerSource, "diamante") == false then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end acao[playerSource] = setTimer(function() end, 1000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setElementData(playerSource, "ouro", false) setElementData(playerSource, "platina", false) setElementData(playerSource, "diamante", true) exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo Diamond VIP por 30 días", 5) if GiveAndTakeAndGetItem("get", playerSource, "diamantes1" or "platinas1" or "ouros1") == 0 then exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1) exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "platinas1", 1) exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "diamantes1", 1) end end else exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5) end end ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- elseif itemUsed == "adesivogrunge" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "padrao") -- MP5 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "padrao") -- Five exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "padrao") -- AK exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "padrao") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "padrao") -- UZI exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "padrao") -- KARAMBIT end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangerak" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "danger") -- AK end, 2000, 1) end else exports.a_infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangerm4" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports.a_infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "danger") -- M4 end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangermp5" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "danger") -- MP5 end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangerfive" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "danger") -- Five end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangerkarambit" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "danger") -- KARAMBIT end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "dangeruzi" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "danger") -- UZI end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "ouros1" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "os1") -- MP5 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "os1") -- Five exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "os1") -- AK exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "os1") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "os1") -- UZI exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "os1") -- KARAMBIT end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "platinas1" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "ps1") -- MP5 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "ps1") -- Five exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "ps1") -- AK exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "ps1") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "ps1") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "ps1") -- KARAMBIT end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end elseif itemUsed == "diamantes1" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end triggerClientEvent(playerSource, "progressBar", playerSource, 2000) acao[playerSource] = setTimer(function() exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5) exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "ds1") -- MP5 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "ds1") -- Five exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "ds1") -- AK exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "ds1") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "ds1") -- M4 exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "ds1") -- KARAMBIT end, 2000, 1) end else exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5) end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ elseif itemUsed == "colete" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if getPedArmor(playerSource) < 100 then acao[playerSource] = setTimer(function() end, 2300, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setPedAnimation(playerSource, "POLICE", "plc_drgbst_01", 2300, false, true, false, false, _, true) setTimer(function() setPedArmor(playerSource, 100) end, 2300, 1) else exports._infobox:addNotification(playerSource, "Ya estas usando un '"..realName[itemUsed][1].."'", "error") end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "faca" or itemUsed == "picareta" or itemUsed == "cutelo" or itemUsed == "taco" or itemUsed == "cassetete" or itemUsed == "pa" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if not arma[playerSource] then setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true) arma[playerSource] = itemUsed giveWeapon(playerSource, weapons[itemUsed][1], 1, true) PlaySound3D(playerSource, "put", 15) toggleControl(playerSource, "next_weapon", false) toggleControl(playerSource, "previous_weapon", false) else if arma[playerSource] == itemUsed then arma[playerSource] = nil takeWeapon(playerSource, weapons[itemUsed][1]) PlaySound3D(playerSource, "put", 15) toggleControl(playerSource, "next_weapon", true) toggleControl(playerSource, "previous_weapon", true) else exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error") end end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "taser" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if not arma[playerSource] then arma[playerSource] = itemUsed giveWeapon(playerSource, weapons[itemUsed][1], 30, true) PlaySound3D(playerSource, "pick", 15) setPedAnimation(playerSource, "BUDDY", "buddy_reload", 1300, false, true, false, false, _, true) toggleControl(playerSource, "next_weapon", false) toggleControl(playerSource, "previous_weapon", false) else if arma[playerSource] == itemUsed then arma[playerSource] = nil takeWeapon(playerSource, weapons[itemUsed][1]) PlaySound3D(playerSource, "put", 15) toggleControl(playerSource, "next_weapon", true) toggleControl(playerSource, "previous_weapon", true) else exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error") end end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "glock" or itemUsed == "deagle" or itemUsed == "escopeta" or itemUsed == "tec9" or itemUsed == "mp5" or itemUsed == "ak47" or itemUsed == "m4a1" or itemUsed == "awm" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if not arma[playerSource] then local ammo = GiveAndTakeAndGetItem("get", playerSource, weapons[itemUsed][2]) or 0 if ammo > 0 then giveWeapon(playerSource, weapons[itemUsed][1], ammo + 1, true) GiveAndTakeAndGetItem("take", playerSource, weapons[itemUsed][2], "all") else giveWeapon(playerSource, weapons[itemUsed][1], 1, true) end setControlState(playerSource, "fire", false) setControlState(playerSource, "action", false) PlaySound3D(playerSource, "pick", 15) arma[playerSource] = itemUsed setPedAnimation(playerSource, "BUDDY", "buddy_reload", 1300, false, true, false, false, _, true) toggleControl(playerSource, "next_weapon", false) toggleControl(playerSource, "previous_weapon", false) else if arma[playerSource] == itemUsed then local ammo = getPedTotalAmmo(playerSource, weapons[itemUsed][3]) or 0 if ammo > 1 then GiveAndTakeAndGetItem("give", playerSource, weapons[itemUsed][2], ammo - 1) end PlaySound3D(playerSource, "put", 15) takeWeapon(playerSource, weapons[itemUsed][1]) arma[playerSource] = nil toggleControl(playerSource, "next_weapon", true) toggleControl(playerSource, "previous_weapon", true) else exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error") end end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "kit_reparo" or itemUsed == "gasolina" or itemUsed == "pneu" or itemUsed == "lockpick" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' hacia un vehiculo proximo para usarlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "algema" or itemUsed == "kitmedico" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en un jugador próximo para usarlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "chaves" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo a '"..realName[itemUsed][1].."' una puerta o portón proximo para abrirlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "drill" or itemUsed == "dinamite" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en una puerta proxima para usarlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "llavesauto" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo a '"..realName[itemUsed][1].."' a tu vehiculo para abrirlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "pendrive" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en un panel de control proximo para usarlo.", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "celular" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then exports._infobox:addNotification(playerSource, "Presione la tecla 'F1' Para usar '"..realName[itemUsed][1].."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "dado" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local random = math.random(1, 4) if random ~= 2 then local random2 = math.random(1, 6) for i, v in pairs(getElementsByType("player")) do local x1, y1, z1 = getElementPosition(playerSource) local x2, y2, z2 = getElementPosition(v) if getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) <= 10 then outputChatBox("[DADO]:#FFFFFF "..random2, v, 30, 144, 255, true) end end else exports._infobox:addNotification(playerSource, "Los dados cayeron lejos y usted los perdió", "error") GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "radinho" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then PlaySound3D(playerSource, "radio-toggle", 15) if not getElementData(playerSource, "Radinho") then setElementData(playerSource, "Radinho", true) else setElementData(playerSource, "Radinho", false) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "presente" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) local random = math.random(1, 6) for i, v in ipairs(tablePresente) do if i == random then if tablePresente[i][1] ~= 5000 and tablePresente[i][1] ~= 20000 then GiveAndTakeAndGetItem("give", playerSource, tablePresente[i][1], 1) exports._infobox:addNotification(playerSource, "Abriste un regalo VIP y ganaste un '"..realName[tablePresente[i][1]][1].."'", "success") else givePlayerMoney(playerSource, tablePresente[i][1]) exports._infobox:addNotification(playerSource, "Abriste un regalo VIP y ganaste $"..tablePresente[i][1], "money") end end end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "capacete" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 800, 1) if isElement(capacete[playerSource]) then setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() destroyElement(capacete[playerSource]) capacete[playerSource] = nil setElementData(playerSource, "Capacete", false) end, 800, 1) else setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) capacete[playerSource] = createObject(1937, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(capacete[playerSource], int) setElementDimension(capacete[playerSource], dim) setElementData(playerSource, "Capacete", true) exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 1, 0, 0.026, 0, 0, 270, 0) end, 800, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "mochila1" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 800, 1) if isElement(capacete[playerSource]) then setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() destroyElement(capacete[playerSource]) capacete[playerSource] = nil setElementData(playerSource, "Capacete", false) end, 800, 1) else setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) capacete[playerSource] = createObject(1945, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(capacete[playerSource], int) setElementDimension(capacete[playerSource], dim) setElementData(playerSource, "Capacete", true) exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.17, 0.07, 0, 0, 0) end, 800, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "mochila2" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 800, 1) if isElement(capacete[playerSource]) then setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() destroyElement(capacete[playerSource]) capacete[playerSource] = nil setElementData(playerSource, "mochila", false) end, 800, 1) else setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) capacete[playerSource] = createObject(1948, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(capacete[playerSource], int) setElementDimension(capacete[playerSource], dim) setElementData(playerSource, "mochila", true) exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.005, -0.18, 0, 0, 90) end, 800, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "mochila3" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 800, 1) if isElement(capacete[playerSource]) then setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() destroyElement(capacete[playerSource]) capacete[playerSource] = nil setElementData(playerSource, "mochila", false) end, 800, 1) else setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) capacete[playerSource] = createObject(1949, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(capacete[playerSource], int) setElementDimension(capacete[playerSource], dim) setElementData(playerSource, "mochila", true) exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.17, 0.07, 0, 0, 0) end, 800, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "porco" or itemUsed == "criatura" or itemUsed == "capeta" or itemUsed == "caveira" or itemUsed == "macaco" or itemUsed == "cavalo" or itemUsed == "touro" or itemUsed == "sacola" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 800, 1) if isElement(mascara[playerSource]) then setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() destroyElement(mascara[playerSource]) mascara[playerSource] = nil end, 800, 1) else setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) mascara[playerSource] = createObject(masks[itemUsed][1], x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(mascara[playerSource], int) setElementDimension(mascara[playerSource], dim) exports.bone_attach:attachElementToBone(mascara[playerSource], playerSource, 1, -0.003, 0, -0.6, 0, 0, 90) end, 800, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "som" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(som[playerSource]) then destroyElement(som[playerSource]) som[playerSource] = nil else setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) som[playerSource] = createObject(2226, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(som[playerSource], int) setElementDimension(som[playerSource], dim) exports.bone_attach:attachElementToBone(som[playerSource], playerSource, 11, 0, 0, 0.4, 180, 0, 180) end, 500, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "maleta" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(maleta[playerSource]) then destroyElement(maleta[playerSource]) maleta[playerSource] = nil else setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) maleta[playerSource] = createObject(1210, x, y, z) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) setElementInterior(maleta[playerSource], int) setElementDimension(maleta[playerSource], dim) exports.bone_attach:attachElementToBone(maleta[playerSource], playerSource, 11, -3.4694469519536e-18, 0.095, 0.3, -6, -184, 0) end, 500, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "flor" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then if isElement(flor[playerSource]) then destroyElement(flor[playerSource]) flor[playerSource] = nil else setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true) setTimer(function() local x, y, z = getElementPosition(playerSource) local dim = getElementDimension(playerSource) local int = getElementInterior(playerSource) flor[playerSource] = createObject(325, x, y, z) setElementInterior(flor[playerSource], int) setElementDimension(flor[playerSource], dim) exports.bone_attach:attachElementToBone(flor[playerSource], playerSource, 12, 0, 0, 0, 0, 270, 0) end, 500, 1) end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "bandagem" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 5000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setPedAnimation(playerSource, "BOMBER", "BOM_Plant_Loop", 5000, true, false, false, false, _, true) setTimer(function() local health = getElementHealth(playerSource) setElementHealth(playerSource, health + 20) setPedAnimation(playerSource, nil) end, 5000, 1) end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cigarro" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if GiveAndTakeAndGetItem("get", playerSource, "isqueiro") >= 1 then if not isTimer(acao[playerSource]) then if not isElement(cigarro[playerSource]) then local x, y, z = getElementPosition(playerSource) local int = getElementInterior(playerSource) local dim = getElementDimension(playerSource) cigarro[playerSource] = createObject(1485, x, y, z) setElementInterior(cigarro[playerSource], int) setElementDimension(cigarro[playerSource], dim) acao[playerSource] = setTimer(function() end, 7000, 1) GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setPedAnimation(playerSource, "GANGS", "smkcig_prtl", 7000, false, true, false, false, _, true) exports.bone_attach:attachElementToBone(cigarro[playerSource], playerSource, 12, -0.03, 0.06, 0.04, 30, -50, -24) local random = math.random(1, 10) if random == 1 then GiveAndTakeAndGetItem("take", playerSource, "isqueiro", 1) end setTimer(function() exports._infobox:addNotification(playerSource, "Presione 'X' para fumar", "info") bindKey(playerSource, "x", "down", fumarCigarro) setTimer(function() destroyElement(cigarro[playerSource]) cigarro[playerSource] = nil unbindKey(playerSource, "x", "down", fumarCigarro) end, 60000*3, 1) end, 7000, 1) else exports._infobox:addNotification(playerSource, "Ya estas fumando un cigarro", "error") end end else exports._infobox:addNotification(playerSource, "No posees 'Mechero' en tu inventario", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "adrenalina" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1) setPedAnimation(playerSource, "BOMBER", "BOM_Plant_Loop", 10000, true, false, false, false, _, true) setTimer(function() if isTimer(acao[playerSource]) then killTimer(acao[playerSource]) end setElementFrozen(playerSource, false) setElementHealth(playerSource, 100) setPedArmor(playerSource, 100) setPedAnimation(playerSource, nil) toggleAllControls(playerSource, true) if getElementData(playerSource, "Desmaiado") then triggerEvent("Desmaiado", root, playerSource, false) end local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..ID1.."]\nAcción: Usó el item 'Inyección de Adrenalina'") for _, players in pairs(getElementsByType("player")) do if players ~= playerSource then local x, y, z = getElementPosition(playerSource) local x2, y2, z2 = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" outputChatBox("[INFO]:#FFFFFF El jugador "..name.."#FFFFFF ("..id..") usó una '"..realName[itemUsed][1].."'", players, 30, 144, 255, true) end end end end, 10000, 1) else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "identidade" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports._infobox:addNotification(playerSource, "[IDENTIDAD] • Nombre: '"..name.."', Nº: '"..id.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cnha" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHA") or "A" exports._infobox:addNotification(playerSource, "[LICENCIA] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cnhb" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHB") or "B" exports._infobox:addNotification(playerSource, "[LICENCIA] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cnhc" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHC") or "C" exports._infobox:addNotification(playerSource, "[LICENCIA] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cnhd" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHD") or "D" exports._infobox:addNotification(playerSource, "[LICENCIA] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "cnhaero" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHE") or "E" exports._infobox:addNotification(playerSource, "[LICENCIA] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "porte" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports._infobox:addNotification(playerSource, "[PORTE DE ARMA] • Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end elseif itemUsed == "distintivo" then if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports._infobox:addNotification(playerSource, "[Placa Policial] • Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info") else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") end end end addEvent("Use", true) addEventHandler("Use", resourceRoot, use) ----------------------------------------------------------------------------------------------------------------------------------------- function trade(tipo, arg2, arg3, arg4) if tipo == "make" then --tipo, source, player, tabela setElementData(arg3, "Trading", arg4) exports._infobox:addNotification(arg3, "Recibiste una propuesta de venta, abre el inventario para Aceptar o Rechazar", "info") triggerClientEvent(arg3, "refreshTrading", resourceRoot) elseif tipo == "accept" then --tipo, source, tabela removeElementData(arg2, "Trading") if GiveAndTakeAndGetItem("get", arg3[1][1], arg3[2][1]) >= arg3[3][1] then if arg3[4][1] > 0 then if getPlayerMoney(arg2) >= arg3[4][1] then if GiveAndTakeAndGetItem("give", arg2, arg3[2][1], arg3[3][1]) then if GiveAndTakeAndGetItem("take", arg3[1][1], arg3[2][1], arg3[3][1]) then takePlayerMoney(arg2, arg3[4][1]) givePlayerMoney(arg3[1][1], arg3[4][1]) exports._infobox:addNotification(arg2, "Aceptaste el comercio y pagaste $"..arg3[4][1], "money") exports._infobox:addNotification(arg3[1][1], "El jugador aceptó comerciar contigo e Recibiste $"..arg3[4][1], "money") local name = getPlayerName(arg2) local ID1 = getElementData(arg2, "ID") or "N/A" local name2 = getPlayerName(arg3[1][1]) local ID2 = getElementData(arg3[1][1], "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nVendedor: "..name2.." ["..ID2.."]\nComprador: "..name.." ["..ID1.."]\nItem: "..arg3[2][1].."\nCantidad: "..arg3[3][1].."\nValor: $"..arg3[4][1]) else exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error") exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error") end else exports._infobox:addNotification(arg2, "No tienes espacio en la mochila", "error") exports._infobox:addNotification(arg3[1][1], "El comprador no tiene espacio en la mochila", "error") end else exports._infobox:addNotification(arg2, "No tienes dinero suficiente", "error") exports._infobox:addNotification(arg3[1][1], "El comprador no tiene dinero suficiente", "error") end else if GiveAndTakeAndGetItem("give", arg2, arg3[2][1], arg3[3][1]) then if GiveAndTakeAndGetItem("take", arg3[1][1], arg3[2][1], arg3[3][1]) then exports._infobox:addNotification(arg2, "Aceptaste comerciar con el jugador", "success") exports._infobox:addNotification(arg3[1][1], "El jugador aceptó comerciar contigo", "success") local name = getPlayerName(arg2) local ID1 = getElementData(arg2, "ID") or "N/A" local name2 = getPlayerName(arg3[1][1]) local ID2 = getElementData(arg3[1][1], "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nVendedor: "..name2.." ["..ID2.."]\nComprador: "..name.." ["..ID1.."]\nItem: "..arg3[2][1].."\nCantidad: "..arg3[3][1].."\nValor: $0") else exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error") exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error") end else exports._infobox:addNotification(arg2, "No tienes espacio en la mochila", "error") exports._infobox:addNotification(arg3[1][1], "El comprador no tiene espacio en la mochila", "error") end end else exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error") exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error") end elseif tipo == "decline" then --tipo, source, tabela removeElementData(arg2, "Trading") exports._infobox:addNotification(arg2, "Rechazaste comerciar con el jugador", "success") exports._infobox:addNotification(arg3[1][1], "El comprador rechazó comerciar contigo", "error") elseif tipo == "distance" then --tipo, source, tabela removeElementData(arg2, "Trading") exports._infobox:addNotification(arg2, "No se puede aceptar comerciar por que estas lejos del vendedor", "error") exports._infobox:addNotification(arg3[1][1], "No se puede aceptar comerciar por que estas lejos del comprador", "error") end end addEvent("Trade", true) addEventHandler("Trade", resourceRoot, trade) ----------------------------------------------------------------------------------------------------------------------------------------- function action(playerSource, clickedWorld, itemActioned) if itemActioned == "chaves" and getElementType(clickedWorld) == "object" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then for i, v in pairs(gates) do if v == clickedWorld then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(GatePositions[i][1])) then if GatePositions[i][10] == "closed" then moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][6], GatePositions[i][7], GatePositions[i][8]) GatePositions[i][10] = "opened" tempo[clickedWorld] = setTimer(function() moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5]) GatePositions[i][10] = "closed" end, 10000, 1) elseif GatePositions[i][10] == "opened" then moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5]) GatePositions[i][10] = "closed" if isTimer(tempo[clickedWorld]) then killTimer(tempo[clickedWorld]) end end else exports._infobox:addNotification(playerSource, "No tienes llaves de ese portón (No tienes permisos)", "error") end end end else exports._infobox:addNotification(playerSource, "Estas muy lejos del protón", "error") end end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "kit_reparo" and getElementType(clickedWorld) == "vehicle" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then local counter = 0 for seat, player in pairs(getVehicleOccupants(clickedWorld)) do counter = counter + 1 end if counter < 1 then if not getElementData(clickedWorld, "Engine") then if getElementHealth(clickedWorld) < 1000 then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Mecanico")) then acao[playerSource] = setTimer(function() end, 14000, 1) if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1938, x, y, z - 0.65, 0, 90, 0) setElementCollisionsEnabled(item[playerSource], false) PlaySound3D(playerSource, "repair", "all") GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) triggerClientEvent(playerSource, "progressBar", playerSource, 14000) setElementFrozen(playerSource, true) setElementFrozen(clickedWorld, true) local _, _, rot = getElementRotation(playerSource) setElementRotation(playerSource, _, _, rot + 180) setPedAnimation(playerSource, "CAR", "fixn_car_loop", 14000, true, false, false, false, _, true) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil fixVehicle(clickedWorld) setVehicleDamageProof(clickedWorld, false) setElementFrozen(clickedWorld, false) setElementFrozen(playerSource, false) local exp = math.random(expRepair1, expRepair2) if getElementData(playerSource, "VIP") then local xp = (exp + (exp/4)) triggerEvent("GiveExp", playerSource, playerSource, xp) else triggerEvent("GiveExp", playerSource, playerSource, exp) end exports._infobox:addNotification(playerSource, "Reparaste el Automovil ", "success") end, 14000, 1) end else exports._infobox:addNotification(playerSource, "El vehiculo no tiene ningun daño para ser reparado", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo necesita estar apagado para ser reparado", "error") end else exports._infobox:addNotification(playerSource, "No debe haber nadie en el vehiculo para poder ser reparado", "error") end else exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end -------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------- elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then local veiculo = getElementData(playerSource, "Vehicle:Owner") if veiculo then if getElementData(veiculo, "Player:Owner") == source then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then if not getElementData(clickedWorld, "engine") then local trancar = getElementData(clickedWorld, "Vehicle:Owner") outputChatBox(" ", source) outputChatBox("• Veículo destrancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) end end end end else setElementData(veiculo, "Locked", true) outputChatBox(" ", source) outputChatBox("• Veículo trancado", source) for i, players in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(players) local ex, ey, ez = getElementPosition(veiculo) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then triggerClientEvent(players, "lockBikeSound", players, veiculo) setTimer(triggerClientEvent, 600, 1, players, "lockBikeSound", players, veiculo) setVehicleOverrideLights(veiculo, 2) setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1) setTimer(setVehicleOverrideLights, 600, 1, veiculo, 2) setTimer(setVehicleOverrideLights, 900, 1, veiculo, 1) end end end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end else exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error") end end end -------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------- elseif itemActioned == "pneu" and getElementType(clickedWorld) == "vehicle" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then local counter = 0 for seat, player in pairs(getVehicleOccupants(clickedWorld)) do counter = counter + 1 end if counter < 1 then if not getElementData(clickedWorld, "Engine") then local r1, r2, r3, r4 = getVehicleWheelStates(clickedWorld) if r1 ~= 0 or r2 ~= 0 or r3 ~= 0 or r4 ~= 0 then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Mecanico")) then acao[playerSource] = setTimer(function() end, 14000, 1) if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1025, x, y, z - 0.85, 0, 90, 0) setObjectScale(item[playerSource], 0.8) setElementCollisionsEnabled(item[playerSource], false) PlaySound3D(playerSource, "repair", 100) GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) triggerClientEvent(playerSource, "progressBar", playerSource, 14000) setElementFrozen(playerSource, true) setElementFrozen(clickedWorld, true) local _, _, rot = getElementRotation(playerSource) setElementRotation(playerSource, _, _, rot + 180) setPedAnimation(playerSource, "CAR", "fixn_car_loop", 14000, true, false, false, false, _, true) setTimer(function() destroyElement(item[playerSource]) item[playerSource] = nil setVehicleWheelStates(clickedWorld, 0, 0, 0, 0) setElementFrozen(clickedWorld, false) setElementFrozen(playerSource, false) local exp = math.random(expPneu1, expPneu2) if getElementData(playerSource, "VIP") then local xp = (exp + (exp/4)) triggerEvent("GiveExp", playerSource, playerSource, xp) else triggerEvent("GiveExp", playerSource, playerSource, exp) end exports._infobox:addNotification(playerSource, "Cambiaste las llantas del vehiculo", "success") end, 14000, 1) end else exports._infobox:addNotification(playerSource, "El vehiculo no presenta ninguna llanta desinflada", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo necesita estar apagado para poder cambiar la llanta", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo necesita estar vacio para poder cambiar la llanta", "error") end else exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "gasolina" and getElementType(clickedWorld) == "vehicle" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then local counter = 0 for seat, player in pairs(getVehicleOccupants(clickedWorld)) do counter = counter + 1 end if counter < 1 then if not getElementData(clickedWorld, "Engine") then local gas = getElementData(clickedWorld, "Gasolina") or 0 if gas < 100 then acao[playerSource] = setTimer(function() end, 15000, 1) if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end local x, y, z = getElementPosition(playerSource) item[playerSource] = createObject(1650, x, y, z) GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) triggerClientEvent(playerSource, "progressBar", playerSource, 15000) setElementFrozen(playerSource, true) setElementFrozen(clickedWorld, true) setPedAnimation(playerSource, "CASINO", "Slot_Plyr", -1, true, false, false, false) setTimer(setPedAnimationSpeed, 700, 1, playerSource, "Slot_Plyr", 0) exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -0.01, 0.15, 0.05, -48, 62, 140) setTimer(function() setPedAnimation(playerSource, nil) destroyElement(item[playerSource]) item[playerSource] = nil setElementData(clickedWorld, "Gasolina", 100) setElementFrozen(clickedWorld, false) setElementFrozen(playerSource, false) exports._infobox:addNotification(playerSource, "Llenaste el tanque del vehiculo", "success") end, 15000, 1) else exports._infobox:addNotification(playerSource, "El vehiculo ya tiene el tanque lleno", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo requiere estar apagado para poder llenarlo", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo requiere estar sin pasajeros para poder llenarlo", "error") end else exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "algema" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(ACL_PM)) then if not algemado[clickedWorld] then if isElement(item[clickedWorld]) then destroyElement(item[clickedWorld]) item[clickedWorld] = nil end local x, y, z = getElementPosition(clickedWorld) item[clickedWorld] = createObject(331, x, y, z) setObjectScale(item[clickedWorld], 1.2) acao[clickedWorld] = setTimer(function() end, 60000*30, 1) GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) GiveAndTakeAndGetItem("give", playerSource, "chaves", 1) setPedAnimation(playerSource, "CASINO", "dealone", 1000, true, false, false, false, _, true) setPedAnimation(clickedWorld, "GANGS","prtial_gngtlkA", 1, false, false, false, true, _, true) setTimer(function() setPedAnimationSpeed(clickedWorld, "prtial_gngtlkA", 0) setTimer(function() setPedAnimationProgress(clickedWorld, "prtial_gngtlkA", 0.2) end, 500, 1) end, 800, 1) toggleControl(clickedWorld, "sprint", false) toggleControl(clickedWorld, "walk", false) toggleControl(clickedWorld, "jump", false) toggleControl(clickedWorld, "fire", false) toggleControl(clickedWorld, "action", false) toggleControl(clickedWorld, "crouch", false) toggleControl(clickedWorld, "aim_weapon", false) toggleControl(clickedWorld, "enter_exit", false) setControlState(clickedWorld, "walk", true) algemado[clickedWorld] = playerSource algemando[playerSource] = clickedWorld exports._infobox:addNotification(playerSource, "Esposaste a un supuesto criminal. Usa tus llaves para soltarlo nuevamente", "success") exports._infobox:addNotification(clickedWorld, "Você foi algemado pelo policial "..getPlayerName(playerSource), "warning") exports.bone_attach:attachElementToBone(item[clickedWorld], clickedWorld, 12, 0.09, 0.03, 0.14, -30, 126, -86) timerAlgema[clickedWorld] = setTimer(function() setPedAnimation(clickedWorld, "GANGS","prtial_gngtlkA", 1, false, false, false, true, _, true) setPedAnimationSpeed(clickedWorld, "prtial_gngtlkA", 0) setPedAnimationProgress(clickedWorld, "prtial_gngtlkA", 0.2) end, 500, 0) else exports._infobox:addNotification(playerSource, "Si objetivo ya esta esposado", "error") end end else exports._infobox:addNotification(playerSource, "Estas muy lejos de tu objetivo", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar a '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "chaves" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if algemado[clickedWorld] then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(ACL_PM)) then if isElement(item[clickedWorld]) then destroyElement(item[clickedWorld]) item[clickedWorld] = nil end if isTimer(acao[clickedWorld]) then killTimer(acao[clickedWorld]) end if isTimer(timerAlgema[clickedWorld]) then killTimer(timerAlgema[clickedWorld]) timerAlgema[clickedWorld] = nil end GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) GiveAndTakeAndGetItem("give", playerSource, "algema", 1) setPedAnimation(clickedWorld, "CASINO", "dealone", -1, false) setTimer(setPedAnimation, 50, 1, clickedWorld, nil) toggleAllControls(clickedWorld, true) setControlState(clickedWorld, "walk", false) exports._infobox:addNotification(playerSource, "Le quitaste las esposas a el criminal", "success") exports._infobox:addNotification(clickedWorld, "El policia "..getPlayerName(playerSource).."#FFFFFF te quitó las esposas", "info") local pm = algemado[clickedWorld] algemando[pm] = nil algemado[clickedWorld] = nil end end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar as '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "kitmedico" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) and not isPedInVehicle(clickedWorld) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(clickedWorld, "Desmaiado") then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Medico")) then acao[playerSource] = setTimer(function() end, 20000, 1) setElementFrozen(playerSource, true) GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) setPedAnimation(playerSource, "MEDIC", "CPR", 20000, true, false, false, false, _, true) triggerClientEvent(playerSource, "progressBar", playerSource, 20000) setTimer(function() triggerEvent("Desmaiado", root, clickedWorld, false) setElementFrozen(playerSource, false) if isTimer(acao[clickedWorld]) then killTimer(acao[clickedWorld]) end exports._infobox:addNotification(playerSource, "Has reanimado a un Ciudadano "..getPlayerName(clickedWorld), "success") exports._infobox:addNotification(clickedWorld, "Fuiste reanimado (RSP) por un paramedico", "info") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local name2 = getPlayerName(clickedWorld) local ID2 = getElementData(clickedWorld, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nEMERGENCIAS: "..name.." ["..ID1.."]\nPaciente: "..name2.." ["..ID2.."]") if curado[playerSource] ~= clickedWorld then local money = math.random(moneySamu1, moneySamu2) givePlayerMoney(playerSource, money) exports._infobox:addNotification(playerSource, "Recibiste "..money.." pesos", "money") local exp = math.random(expSamu1, expSamu2) if getElementData(playerSource, "VIP") then local xp = (exp + (exp/4)) triggerEvent("GiveExp", playerSource, playerSource, xp) else triggerEvent("GiveExp", playerSource, playerSource, exp) end end curado[playerSource] = clickedWorld end, 20000, 1) end else exports._infobox:addNotification(playerSource, "Este ciudadano no requiere ser auxiliado", "error") end else exports._infobox:addNotification(playerSource, "Estas muy lejos del ciudadano indicado", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "lockpick" and getElementType(clickedWorld) == "vehicle" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 2.5 then local counter = 0 for seat, player in pairs(getVehicleOccupants(clickedWorld)) do counter = counter + 1 end if counter < 1 then if getElementData(clickedWorld, "Locked") then acao[playerSource] = setTimer(function() end, 90000, 1) GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1) PlaySound3D(playerSource, "vehicle-alarm", "all") setElementFrozen(playerSource, true) setElementFrozen(clickedWorld, true) setPedAnimation(playerSource, "CAMERA", "piccrch_take", 90000, true, false, false, false, _, true) triggerClientEvent(playerSource, "progressBar", playerSource, 90000) blip[clickedWorld] = createBlipAttachedTo(clickedWorld, 36) setElementVisibleTo(blip[clickedWorld], root, false) for _, players in pairs(getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_PM)) then exports._infobox:addNotification(players, "[ESTACIÓN]: Reporte de robo de vehículo en curso, el lugar de ocurrencia fue indicado en su GPS", "warning") setElementVisibleTo(blip[clickedWorld], players, true) end end setTimer(function() setPedAnimation(playerSource, nil) setElementFrozen(playerSource, false) setElementFrozen(clickedWorld, false) destroyElement(blip[clickedWorld]) blip[clickedWorld] = nil local random = math.random(1, 2) if random == 1 then setElementData(clickedWorld, "Locked", false) setVehicleLocked(clickedWorld, false) exports._infobox:addNotification(playerSource, "¿Conseguiste forzar el vehículo", "success") local name = getPlayerName(playerSource) local ID1 = getElementData(playerSource, "ID") or "N/A" local model = getElementModel(clickedWorld) exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nCriminal: "..name.." ["..ID1.."]\nVehiculo: "..model) else exports._infobox:addNotification(playerSource, "No conseguiste forzar el vehiculo", "error") end end, 90000, 1) else exports._infobox:addNotification(playerSource, "Este vehiculo ya esta desbloqueado", "error") end else exports._infobox:addNotification(playerSource, "El vehiculo requiere estar vacio para poder ser forzado", "error") end else exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "porte" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports._infobox:addNotification(clickedWorld, "[PORTE DE ARMA] • Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "cnha" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(playerSource, "license:moto") then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHA") or "A" exports._infobox:addNotification(clickedWorld, "[Licencia] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "cnhb" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(playerSource, "license:auto") then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHB") or "B" exports._infobox:addNotification(clickedWorld, "[Licencia] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemUsed == "cnhc" and getElementType(clickedWorld) == "player" then if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(playerSource, "license:gruz") then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHC") or "C" exports._infobox:addNotification(clickedWorld, "[Licencia] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemUsed == "cnhd" and getElementType(clickedWorld) == "player" then if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(playerSource, "license:pass") then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHD") or "D" exports._infobox:addNotification(clickedWorld, "[Licencia] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemUsed == "cnhaero" and getElementType(clickedWorld) == "player" then if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(playerSource, "license:air") then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local categoria = getElementData(playerSource, "CNHE") or "E" exports._infobox:addNotification(clickedWorld, "[Licencia] • Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end ------------------------------------------------------------------------------------------------------------- elseif itemActioned == "identidade" and getElementType(clickedWorld) == "player" then --Comienza if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" local wanted = getPlayerWantedLevel(playerSource) exports._infobox:addNotification(clickedWorld, "[IDENTIDAD] • Nombre: '"..name.."', Nº: '"..id.."', Antecedentes Penales: '"..wanted.."'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end --Termina else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "distintivo" and getElementType(clickedWorld) == "player" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports._infobox:addNotification(clickedWorld, "[Placa Policial] • Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info") exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success") end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end -- ----------------------------------------------------------------------- elseif itemActioned == "dinamite" and getElementType(clickedWorld) == "object" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(clickedWorld, "Bank:Gate1") then triggerEvent("Banco:Iniciar", root, playerSource) end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "pendrive" and getElementType(clickedWorld) == "object" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(clickedWorld, "Bank:Pass") then triggerEvent("Banco:Hackear", root, playerSource) end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end elseif itemActioned == "drill" and getElementType(clickedWorld) == "object" then if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(clickedWorld) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if getElementData(clickedWorld, "Bank:Gate3") then triggerEvent("Banco:Furadeira", root, playerSource) end end end else exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error") end else exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error") end end end addEvent("Action", true) addEventHandler("Action", resourceRoot, action) ----------------------------------------------------------------------------------------------------------------------------------------- function trash(playerSource, item, qntd) if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 1300, 1) setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true) setTimer(function() PlaySound3D(playerSource, "trash", 20) GiveAndTakeAndGetItem("take", playerSource, item, qntd) exports._infobox:addNotification(playerSource, "Has desechado "..qntd.."x '"..realName[item][1].."'", "success") local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nAcción: Desechó basura") for _, players in pairs(getElementsByType("player")) do if players ~= playerSource then local x, y, z = getElementPosition(playerSource) local x2, y2, z2 = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") Desechó "..qntd.."x '"..realName[item][1].."' en una papelera cercana a usted.", players, 30, 144, 255, true) end end end end, 1300, 1) end end else exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error") end end addEvent("Trash", true) addEventHandler("Trash", resourceRoot, trash) ----------------------------------------------------------------------------------------------------------------------------------------- function box(estado, playerSource, gang, item, qntd) if estado == "guardar" then for i, v in pairs(BoxPositions) do if BoxPositions[i][1] == gang then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then if not isPedInVehicle(playerSource) then if not isTimer(acao[playerSource]) then acao[playerSource] = setTimer(function() end, 1300, 1) setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true) setTimer(function() PlaySound3D(playerSource, "trash", 20) GiveAndTakeAndGetItem("take", playerSource, item, qntd) exports._infobox:addNotification(playerSource, "Guardaste "..qntd.."x '"..realName[item][1].."'", "success") local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nBaul: "..gang.."\nAcción: "..estado) for _, players in pairs(getElementsByType("player")) do if players ~= playerSource then local x, y, z = getElementPosition(playerSource) local x2, y2, z2 = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") guardo "..qntd.."x '"..realName[item][1].."' cercano a usted.", players, 30, 144, 255, true) end end end if bau[gang][item] then bau[gang][item][1] = bau[gang][item][1] + tonumber(qntd) else bau[gang][item] = {} bau[gang][item][1] = tonumber(qntd) end end, 1300, 1) end end else exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error") end end end end elseif estado == "pegar" then for i, v in pairs(BoxPositions) do if BoxPositions[i][1] == gang then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then if bau[gang][item] then if bau[gang][item][1] >= qntd then if GiveAndTakeAndGetItem("give", playerSource, item, qntd) then bau[gang][item][1] = bau[gang][item][1] - qntd if bau[gang][item][1] <= 0 then bau[gang][item] = nil end exports._infobox:addNotification(playerSource, "Colocaste "..qntd.."x '"..realName[item][1].."'", "success") local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nBaul: "..gang.."\nAcción: "..estado) for _, players in pairs(getElementsByType("player")) do if players ~= playerSource then local x, y, z = getElementPosition(playerSource) local x2, y2, z2 = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then local name = getPlayerName(playerSource) local id = getElementData(playerSource, "ID") or "N/A" outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") puso "..qntd.."x '"..realName[item][1].."' en un baul cercano a ti.", players, 30, 144, 255, true) end end end else exports._infobox:addNotification(playerSource, "No tienes capacidad en la mochila para sacar este item", "error") end else exports._infobox:addNotification(playerSource, "El baul no posee la cantidad indicada de este item", "error") end else exports._infobox:addNotification(playerSource, "El baul no posee este item", "error") end end end end end end addEvent("Box", true) addEventHandler("Box", resourceRoot, box) ----------------------------------------------------------------------------------------------------------------------------------------- function click(button, state, playerSource) if button == "left" and state == "down" then if getElementType(source) == "object" then if getElementModel(source) == 1227 then for i, v in pairs(boxes) do if v == source then local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(source) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then local gangBox = BoxPositions[i][1] triggerClientEvent(playerSource, "RenderBox", resourceRoot, bau[gangBox], gangBox) end end end end end end end end addEventHandler("onElementClicked", root, click) ----------------------------------------------------------------------------------------------------------------------------------------- function fumarCigarro(source) if isElement(cigarro[source]) then if not isTimer(acao[source]) then acao[source] = setTimer(function() end, 7000, 1) setPedAnimation(source, "GANGS", "smkcig_prtl", 7000, false, true, false, false, _, true) end end end ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- function onLogin(_, account) if not isGuestAccount(account) then timerStart[source] = setTimer(function(source) inventario[source] = {} if getAccountData(account, "Inventario") then local itens = fromJSON(getAccountData(account, "Inventario")) for index, value in pairs(itens) do if realName[itens[index][1]] then table.insert(inventario[source], value) end end end triggerClientEvent(source, "refresh", resourceRoot, inventario[source]) end, 10000, 1, source) end end addEventHandler("onPlayerLogin", root, onLogin) ----------------------------------------------------------------------------------------------------------------------------------------- function onQuit() local account = getPlayerAccount(source) if not isGuestAccount(account) then if not isTimer(timerStart[source]) then local itens = toJSON(inventario[source]) setAccountData(account, "Inventario", itens) takeAllWeapons(source) acao[source] = nil arma[source] = nil algemado[source] = nil algemando[source] = nil curado[source] = nil inventario[source] = nil if isTimer(timerAlgema[source]) then killTimer(timerAlgema[source]) timerAlgema[source] = nil end if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end if isElement(capacete[source]) then destroyElement(capacete[source]) capacete[source] = nil setElementData(source, "Capacete", false) end if isElement(mascara[source]) then destroyElement(mascara[source]) mascara[source] = nil end if isElement(maleta[source]) then destroyElement(maleta[source]) maleta[source] = nil end if isElement(som[source]) then destroyElement(som[source]) som[source] = nil end if isElement(flor[source]) then destroyElement(flor[source]) flor[source] = nil end if isElement(cigarro[source]) then destroyElement(cigarro[source]) cigarro[source] = nil end if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end end end end addEventHandler("onPlayerQuit", root, onQuit) ----------------------------------------------------------------------------------------------------------------------------------------- function onStart() for i, players in pairs(getElementsByType("player")) do timerStart[players] = setTimer(function() local account = getPlayerAccount(players) if not isGuestAccount(account) then inventario[players] = {} if getAccountData(account, "Inventario") then local itens = fromJSON(getAccountData(account, "Inventario")) for index, value in pairs(itens) do if realName[itens[index][1]] then table.insert(inventario[players], value) end end end triggerClientEvent(players, "refresh", resourceRoot, inventario[players]) end end, 10000, 1) end for i, v in pairs(bau) do local data = executeSQLQuery("SELECT * FROM Baú WHERE gang = ?", i) if data and type(data) == "table" and #data ~= 0 then data[1].valor = fromJSON(data[1].valor) for index, value in pairs(data[1].valor) do bau[i][index] = {} bau[i][index][1] = data[1].valor[index][1] end end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart) ----------------------------------------------------------------------------------------------------------------------------------------- function onStop() for i, players in pairs(getElementsByType("player")) do local account = getPlayerAccount(players) if not isGuestAccount(account) then if not isTimer(timerStart[players]) then local itens = toJSON(inventario[players]) setAccountData(account, "Inventario", itens) end end end executeSQLQuery("CREATE TABLE IF NOT EXISTS Baú (gang TEXT, valor TEXT)") for i, v in pairs(bau) do executeSQLQuery("DELETE FROM Baú WHERE gang = ?", i) executeSQLQuery("INSERT INTO Baú (gang, valor) VALUES (?, ?)", i, toJSON(bau[i])) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), onStop) ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- function Refresh(playerSource) local int = getElementInterior(playerSource) local dim = getElementDimension(playerSource) if isElement(item[playerSource]) then setElementInterior(item[playerSource], int) setElementDimension(item[playerSource], dim) end if isElement(capacete[playerSource]) then setElementInterior(capacete[playerSource], int) setElementDimension(capacete[playerSource], dim) end if isElement(mascara[playerSource]) then setElementInterior(mascara[playerSource], int) setElementDimension(mascara[playerSource], dim) end if isElement(maleta[playerSource]) then setElementInterior(maleta[playerSource], int) setElementDimension(maleta[playerSource], dim) end if isElement(som[playerSource]) then setElementInterior(som[playerSource], int) setElementDimension(som[playerSource], dim) end if isElement(flor[playerSource]) then setElementInterior(flor[playerSource], int) setElementDimension(flor[playerSource], dim) end if isElement(cigarro[playerSource]) then setElementInterior(cigarro[playerSource], int) setElementDimension(cigarro[playerSource], dim) end end addEvent("RefreshBoneAttach", true) addEventHandler("RefreshBoneAttach", root, Refresh) ----------------------------------------------------------------------------------------------------------------------------------------- function PlaySound3D(playerSource, som, distance) if distance == "all" then triggerClientEvent(root, "playSound", resourceRoot, som, playerSource) else for i, players in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(playerSource) local ex, ey, ez = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= distance then triggerClientEvent(players, "playSound", resourceRoot, som, playerSource) end end end end ----------------------------------------------------------------------------------------------------------------------------------------- function onWasted() if not getElementData(source, "Staff") then for index = #inventario[source], 1, -1 do local item = inventario[source][index][1] if not itensCantRemoved[item] then GiveAndTakeAndGetItem("take", source, item, "all") end end end takeAllWeapons(source) curado[source] = nil acao[source] = nil arma[source] = nil if isElement(cigarro[source]) then destroyElement(cigarro[source]) cigarro[source] = nil unbindKey(source, "x", "down", fumarCigarro) end if algemado[source] then destroyElement(item[source]) item[source] = nil killTimer(timerAlgema[source]) timerAlgema[source] = nil setControlState(source, "walk", false) end if algemando[source] then algemando[source] = nil end end addEventHandler("onPlayerWasted", root, onWasted) ----------------------------------------------------------------------------------------------------------------------------------------- function removeItem(playerSource, item) if item == "radinho" then setElementData(playerSource, "Radinho", false) elseif item == "porco" or item == "criatura" or item == "capeta" or item == "caveira" or item == "macaco" or item == "cavalo" or item == "touro" or item == "sacola" then destroyElement(mascara[playerSource]) mascara[playerSource] = nil elseif item == "maleta" then destroyElement(maleta[playerSource]) maleta[playerSource] = nil elseif item == "capacete" then destroyElement(capacete[playerSource]) capacete[playerSource] = nil setElementData(playerSource, "Capacete", false) elseif item == "som" then destroyElement(som[playerSource]) som[playerSource] = nil elseif item == "flor" then destroyElement(flor[playerSource]) flor[playerSource] = nil else if arma[playerSource] == item then local ammo = getPedTotalAmmo(playerSource, weapons[item][3]) or 0 if ammo > 1 then GiveAndTakeAndGetItem("give", playerSource, weapons[item][2], ammo - 1) end arma[playerSource] = nil takeWeapon(playerSource, weapons[item][1]) end end end Edited June 29, 2022 by Wananazo 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