• 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!

[TFS] Npc Trader

domilol

Banned User
Joined
Nov 19, 2007
Messages
24
Reaction score
0
Does anyone have a script where the npc gives x item if you bring it x of one item, x of another, and x of another?
 
PHP:
if getPlayerItemCount(cid,itemid) >= count then
     if getPlayerItemCount(cid,itemid) >= count then
          if getPlayerItemCount(cid,itemid >= count then
              doPlayerRemoveItem(cid,itemid,count)
              doPlayerRemoveItem(cid,itemid,count)
              doPlayerRemoveItem(cid,itemid,count)
              doPlayerAddItem(cid,item,count)
              selfSay('Here you go.')
          else
                selfSay('You don\'t have the right item.')
          end
     else
           selfSay('You don\'t have the right item.')
     end
else
       selfSay('You don\'t have the right item.')
end
 
Last edited:
- global.lua
PHP:
function doPlayerRemoveItems(cid, ...)
    for _,v in pairs(arg) do
        if getPlayerItemCount(cid, v[1]) < v[2] or 1 then
            return 0
        end
    end
    for _,v in pairs(arg) do
        doPlayerRemoveItem(cid, v[1], v[2] or 1)
    end
    return 1
end

in npc:
PHP:
if doPlayerRemoveItems(cid, {itemid, count}, {itemid, count}, {itemid, count}) == 1 then
    doPlayerAddItem(cid,item,count)
    selfSay('Here you go.')
else
    selfSay('You don\'t have the right items.')
end
 

Similar threads

Replies
1
Views
299
Back
Top