Hitsugaya
Active User
- Joined
- Apr 4, 2008
- Messages
- 114
- Reaction score
- 3
Witam. Skrypt na kupowanie pochodzi oryginalnie z silnika TFSa 0.3.6pl1 przerobiony przezemnie na kupowanie w sklepie magicznym oto on :
Kiedy kupuj? runki, potki to wszystko jest ok, ale je?li chc? kupi? np r??d?k? oboj?tnie jak? to wyskakuje mi taki b??d w silniku :
Niniejsze skrypty w kt?rych jest b??d s? oryginalnymi z TFSa.
module.lua linijki 1156 oraz 1292 :
1156:
1292 :
oraz npchandler.lua linijki 263 oraz 440 :
263 :
440 :
Nie wiem co jest z nimi nie tak
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
shopModule:addBuyableItem({'magic lightwand'}, 2163, 400, 'magic lightwand')
shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
shopModule:addBuyableItem({'antidote potion'}, 8474, 50, 1, 'antidote potion')
shopModule:addBuyableItem({'instense healing'}, 2265, 95, 1, 'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'magic wall'}, 2293, 350, 3, 'magic wall rune')
shopModule:addBuyableItem({'destroy field'}, 2261, 45, 3, 'destroy field rune')
shopModule:addBuyableItem({'light magic missile'}, 2287, 40, 10, 'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 2311, 120, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'explosion'}, 2313, 250, 6, 'explosion rune')
shopModule:addBuyableItem({'sudden death'}, 2268, 350, 3, 'sudden death rune')
shopModule:addBuyableItem({'death arrow'}, 2263, 300, 3, 'death arrow rune')
shopModule:addBuyableItem({'paralyze'}, 2278, 700, 1, 'paralyze rune')
shopModule:addBuyableItem({'animate dead'}, 2316, 375, 1, 'animate dead rune')
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1, 'convince creature rune')
shopModule:addBuyableItem({'chameleon'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 3, 'desintegreate rune')
shopModule:addBuyableItem({'wand of vortex'}, 2190, 500, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath'}, 2191, 1000, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of draconia'}, 8921, 7500, 'wand of draconia')
shopModule:addBuyableItem({'wand of cosmic energy'}, 2189, 10000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of starstorm'}, 8920, 18000, 'wand of starstorm')
shopModule:addBuyableItem({'wand of voodoo'}, 8922, 22000, 'wand of voodoo')
shopModule:addBuyableItem({'snakebite rod'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod'}, 2186, 1000, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod'}, 2185, 5000, 'necrotic rod')
shopModule:addBuyableItem({'northwind rod'}, 8911, 7500, 'northwind rod')
shopModule:addBuyableItem({'terra rod'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod'}, 2183, 15000, 'hailstorm rod')
shopModule:addBuyableItem({'springsprout rod'}, 8912, 18000, 'springsprout rod')
shopModule:addBuyableItem({'underworld rod'}, 8910, 22000, 'underworld rod')
shopModule:addSellableItem({'wand of vortex'}, 2190, 250, 'wand of vortex')
shopModule:addSellableItem({'wand of dragonbreath'}, 2191, 500, 'wand of dragonbreath')
shopModule:addSellableItem({'wand of decay'}, 2188, 2500, 'wand of decay')
shopModule:addSellableItem({'wand of draconia'}, 8921, 3750, 'wand of draconia')
shopModule:addSellableItem({'wand of cosmic energy'}, 2189, 5000, 'wand of cosmic energy')
shopModule:addSellableItem({'wand of inferno'},2187, 7500, 'wand of inferno')
shopModule:addSellableItem({'wand of starstorm'}, 8920, 9000, 'wand of starstorm')
shopModule:addSellableItem({'wand of voodoo'}, 8922, 11000, 'wand of voodoo')
shopModule:addSellableItem({'snakebite rod'}, 2182, 250,'snakebite rod')
shopModule:addSellableItem({'moonlight rod'}, 2186, 500, 'moonlight rod')
shopModule:addSellableItem({'necrotic rod'}, 2185, 2500, 'necrotic rod')
shopModule:addSellableItem({'northwind rod'}, 8911, 3750, 'northwind rod')
shopModule:addSellableItem({'terra rod'}, 2181, 5000, 'terra rod')
shopModule:addSellableItem({'hailstorm rod'}, 2183, 7500, 'hailstorm rod')
shopModule:addSellableItem({'springsprout rod'}, 8912, 9000, 'springsprout rod')
shopModule:addSellableItem({'underworld rod'}, 8910, 11000, 'underworld rod')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Kiedy kupuj? runki, potki to wszystko jest ok, ale je?li chc? kupi? np r??d?k? oboj?tnie jak? to wyskakuje mi taki b??d w silniku :
Niniejsze skrypty w kt?rych jest b??d s? oryginalnymi z TFSa.
module.lua linijki 1156 oraz 1292 :
1156:
Code:
if(shopItem.buy == -1) then
[COLOR="Red"]error("[ShopModule.onSell]", "Attempt to purchase an item which only sellable")[/COLOR]
return false
end
1292 :
Code:
function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
[COLOR="Red"]module.npcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)[/COLOR]
end,
oraz npchandler.lua linijki 263 oraz 440 :
263 :
Code:
function NpcHandler:processModuleCallback(id, ...)
local ret = true
for i, module in pairs(self.modules) do
local tmpRet = true
if(id == CALLBACK_CREATURE_APPEAR and module.callbackOnCreatureAppear ~= nil) then
tmpRet = module:callbackOnCreatureAppear(unpack(arg))
elseif(id == CALLBACK_CREATURE_DISAPPEAR and module.callbackOnCreatureDisappear ~= nil) then
tmpRet = module:callbackOnCreatureDisappear(unpack(arg))
elseif(id == CALLBACK_CREATURE_SAY and module.callbackOnCreatureSay ~= nil) then
tmpRet = module:callbackOnCreatureSay(unpack(arg))
elseif(id == CALLBACK_PLAYER_ENDTRADE and module.callbackOnPlayerEndTrade ~= nil) then
tmpRet = module:callbackOnPlayerEndTrade(unpack(arg))
elseif(id == CALLBACK_PLAYER_CLOSECHANNEL and module.callbackOnPlayerCloseChannel ~= nil) then
tmpRet = module:callbackOnPlayerCloseChannel(unpack(arg))
elseif(id == CALLBACK_ONBUY and module.callbackOnBuy ~= nil) then
[COLOR="Red"]tmpRet = module:callbackOnBuy(unpack(arg))[/COLOR]
elseif(id == CALLBACK_ONSELL and module.callbackOnSell ~= nil) then
tmpRet = module:callbackOnSell(unpack(arg))
elseif(id == CALLBACK_ONTHINK and module.callbackOnThink ~= nil) then
tmpRet = module:callbackOnThink(unpack(arg))
elseif(id == CALLBACK_GREET and module.callbackOnGreet ~= nil) then
tmpRet = module:callbackOnGreet(unpack(arg))
elseif(id == CALLBACK_FAREWELL and module.callbackOnFarewell ~= nil) then
tmpRet = module:callbackOnFarewell(unpack(arg))
elseif(id == CALLBACK_MESSAGE_DEFAULT and module.callbackOnMessageDefault ~= nil) then
tmpRet = module:callbackOnMessageDefault(unpack(arg))
elseif(id == CALLBACK_MODULE_RESET and module.callbackOnModuleReset ~= nil) then
tmpRet = module:callbackOnModuleReset(unpack(arg))
end
440 :
Code:
function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
local callback = self:getCallback(CALLBACK_ONBUY)
if(callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks)) then
[COLOR="Red"]if(self:processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks)) then[/COLOR]
--
end
end
end
Nie wiem co jest z nimi nie tak