• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

doPlayerRemoveItem with 2 or more items?

snacky

New Member
Joined
Apr 16, 2009
Messages
126
Reaction score
1
Hi, as title says, how can I remove 2 or more items from a player?

I've tried the following, but no success nor error consoles.


Code:
  local pirateItems = {5462,6096,6095,5918}
  local count = 1
..........
if doPlayerRemoveItem(cid, pirateItems, count) then
selfSay('Good')
end


Thanks
 
Hi, as title says, how can I remove 2 or more items from a player?

I've tried the following, but no success nor error consoles.


Code:
  local pirateItems = {5462,6096,6095,5918}
  local count = 1
..........
if doPlayerRemoveItem(cid, pirateItems, count) then
selfSay('Good')
end


Thanks

try something like

Code:
..........
if doPlayerRemoveItem(cid, 2000, 1) and doPlayerRemoveItem(cid, 2000, 1) then
selfSay('Good')
end
 
PHP:
local items = {5462, 6096, 6095, 5918}

local result = true
for _, item in pairs(items) do
  if player:getItemCount(item) < 1 then
    result = false
    break
  end
end

if result then
  for _, item in pairs(items) do
    player:removeItem(item, 1)
  end
  -- everything is okay
else
  -- selfSay("Sorry, ...")
end
 
Back
Top