Matti96
Abyss
ćlose close close
Last edited:
noone said that i copy it maybe i add new items o.ô
for i, item in ipairs(items) do
par = getFullParam(par)
if item[1] == 1 then
table items = {4891, 35000}
local item = getItemIdByName(string.lower(param), false)
if items[item] ~= nil then
do whatever you want with items[item]
else
this item is not buyable.
ty for script.
but i gotta ask a thing:
why are so many of the semi-pro scripters on otland doing this:
PHP:for i, item in ipairs(items) do par = getFullParam(par) if item[1] == 1 then
people here must learn that you dont need to loop, to check for a match in a table!!! heres what you should have done:
PHP:table items = {4891, 35000} local item = getItemIdByName(string.lower(param), false) if items[item] ~= nil then do whatever you want with items[item] else this item is not buyable.
items = {
["bp swords"] = {price = 2000}
}
if items[param] then
-- blablabla
end
ty for script.
but i gotta ask a thing:
why are so many of the semi-pro scripters on otland doing this:
PHP:for i, item in ipairs(items) do par = getFullParam(par) if item[1] == 1 then
people here must learn that you dont need to loop, to check for a match in a table!!! heres what you should have done:
PHP:table items = {4891, 35000} local item = getItemIdByName(string.lower(param), false) if items[item] ~= nil then do whatever you want with items[item] else this item is not buyable.
Agree, loops are useless and takes more memory...
Since I use anonymous tables, I need to do so. I really hate to write:
Code:items = { ["bp swords"] = {price = 2000} } if items[param] then -- blablabla end
There are less options for multiple keywords. On the example above, I can only have one keyword, otherwise I'll have to make two tables for the same item.
Loops are NOT bad! They are useful and should be used more often, even on these cases.
local items = {
[1239] = 3000 -- itemid, price
}