Kevyn Martinss Posted January 10, 2021 Share Posted January 10, 2021 function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end function playerHasItem(player, itemID) for i, v in pairs(getElementData(player, 'TS:InventarioInfo')) do if type(v) == 'table' then if v['Item'] == tonumber(itemID) then return true end end end return false end function returnQntdItem(player, itemID) if (player) then for i, v in pairs(getElementData(player, "TS:InventarioInfo")) do if (type(v) == "table") then if (v['Item'] == tonumber(itemID)) then return v['Quantidade'] end end end end return false end function verificarDistancia (player, abordado) if player and abordado then local x,y,z = getElementPosition(player) local x2,y2,z2 = getElementPosition(abordado) local distancia = getDistanceBetweenPoints3D(x,y,z,x2,y2,z2) if distancia then return distancia end end end local items = { [9] = "Cerveja(s)", } function revista (thePlayer, commandName, id) if (tonumber(id)) then local targetPlayer = getPlayerID(tonumber(id)) if (targetPlayer) then if (verificarDistancia (thePlayer, targetPlayer) > 5) then outputChatBox ("O jogador com este ID não está perto o suficiente para ser revistado.", thePlayer, 255, 150, 0) return end for i, item in pairs (items) do if (playerHasItem (targetPlayer, i) == true) then else outputChatBox ("Mochila Vazia") outputChatBox ("Libere o Cidadão") end end else outputChatBox ("✘#ffffffINFO#0037FF✘➺ #ffffff O Cidadão tem "..returnQntdItem (targetPlayer, i).." "..item.." em sua mochila!", thePlayer, 0, 55, 255, true) end end end addCommandHandler ("revistar", revista) ja tentei de todas formas esse codigo e não consigo alguem poderia me dizer aonde esta o erro ou me ajudar no codigo? 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