Amiroslo
Excellent OT User
- Joined
- Jul 28, 2009
- Messages
- 6,812
- Solutions
- 6
- Reaction score
- 822
Hello, Im using this shop system
when someone say !buy X item that shows, im using 0.3.6pl1
shop.lua
and this is when i use the other command
rep++ for fixer
when someone say !buy X item that shows, im using 0.3.6pl1
Code:
[Error - TalkAction Interface]
data/talkactions/scripts/shop.lua:onSay
Description:
data/talkactions/scripts/shop.lua:42: attempt to compare number with boolean
stack traceback:
data/talkactions/scripts/shop.lua:42: in function <data/talkactions/scripts/shop.lua:28>
Code:
[Error - TalkAction Interface]
data/talkactions/scripts/shop.lua:onSay
Description:
data/talkactions/scripts/shop.lua:47: attempt to call global 'getAccountPoints' (a nil value)
stack traceback:
data/talkactions/scripts/shop.lua:47: in function <data/talkactions/scripts/shop.lua:28>
LUA:
local shop = {
["crystal coins"] = {id = 2160, cost = 100, charges = 100},
["solar axe"] = {id = 8925, cost = 210, charges = 1},
["solar sword"] = {id = 8931, cost = 210, charges = 1},
["dark mace"] = {id = 8927, cost = 210, charges = 1},
["soft boots"] = {id = 6132, cost = 210, charges = 1},
["slingshot"] = {id = 5907, cost = 210, charges = 1},
["star tear"] = {id = 7735, cost = 210, charges = 1},
["blessing book"] = {id = 8977, cost = 1350, charges = 1},
["stamina feather"] = {id = 2366, cost = 450, charges = 1},
["infinite amulet"] = {id = 2138, cost = 650, charges = 1},
["yalahari mask"] = {id = 9778, cost = 100, charges = 1},
["yalahari armor"] = {id = 9776, cost = 100, charges = 1},
["yalahari legs"] = {id = 9777, cost = 100, charges = 1},
["nightmare shield"] = {id = 6391, cost = 50, charges = 1},
["master archers armor"] = {id = 8888, cost = 210, charges = 1},
["robe of the underworld"] = {id = 8890, cost = 210, charges = 1},
["snake gods wristguard"] = {id = 12608, cost = 210, charges = 1},
["firewalker boots"] = {id = 9933, cost = 440, charges = 1},
["kosheis ancient amulet"] = {id = 8266, cost = 100, charges = 1},
["earthborn titan armor"] = {id = 8882, cost = 210, charges = 1},
["fireborn giant armor"] = {id = 8881, cost = 210, charges = 1},
["windborn collosus armor"] = {id = 8883, cost = 210, charges = 1},
["blood herb"] = {id = 2798, cost = 3, charges = 25},
["addon doll"] = {id = 8982, cost = 450, charges = 1}
}
function onSay(cid, words, param, channel)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
local v = shop[param]
if (not v) then
doPlayerSendCancel(cid,"Item not found.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
local itemm = getItemWeightById(v.id, v.charges)
if getPlayerFreeCap(cid) < itemm then
doPlayerSendCancel(cid, "Sorry, you do not have enough cap. You need "..itemm.." oz to carry "..param..".")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if (getAccountPoints(cid) < v.cost) then
doPlayerSendCancel(cid, "Sorry, you need "..v.cost.." points to buy this item.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
else
doPlayerAddItem(cid,v.id,v.charges)
doRemovePoints(cid,v.cost)
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Thanks for buying!")
doWriteLogFile("data/logs/buyeditems.txt", "[".. os.date('%d %B %y - %H:%M') .."] ".. getCreatureName(cid) .." bought "..param.." for "..v.cost.." points.")
end
return true
end
and this is when i use the other command
buyvip30.lua[Error - TalkAction Interface]
data/talkactions/scripts/buyvip30.luanSay
Description:
data/talkactions/scripts/buyvip30.lua:3: attempt to call global 'getAccountPoints' (a nil value)
stack traceback:
data/talkactions/scripts/buyvip30.lua:3: in function <data/talkactions/scripts/buyvip30.lua:2>
LUA:
-- Vip System by 5mok3 --
function onSay(cid, words, param, channel)
if getAccountPoints(cid) >= 10 then
--[[if getPlayerPromotionLevel(cid) < 2 then
setPlayerPromotionLevel(cid, 2)
end]]
doSendMagicEffect(getCreaturePosition(cid),14)
doSendAnimatedText(getCreaturePosition(cid), "VIP +30!" ,49)
doAddVipDays(cid, 30)
doRemovePoints(cid, 10)
doWriteLogFile("data/logs/buyeditems.txt", "[".. os.date('%d %B %y - %H:%M') .."] ".. getCreatureName(cid) .." bought VIP for 10 points.")
--[[local thing = getThingfromPos(pos)
doRemoveCreature(thing.uid)]]
else
doPlayerSendCancel(cid, "Not enough Premium Points or already have more than 365 VIP days!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return TRUE
end
rep++ for fixer