YisusChrist
Banned User
- Joined
- Jul 9, 2013
- Messages
- 47
- Reaction score
- 0
Rashid Problem at Line 129 Function ( Script work BUT Rashid Do not TP )
function onThink() <<< Line 129
and Gnomally Line 7 Attempt to call method 'Docreaturesay' a nil value
Line 7 >> function doCreatureSay(cid, type, msg) npcHandler:doCreatureSay(cid, type, msg) end
If anyone can help me with this will be great and ill be grateful
Kind Regards
YisusChrist
function onThink() <<< Line 129
PHP:
local talk_start = 0
local focus = 0
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addSellableItem({'voodoo doll', 'voodoo doll'}, 3955, 400, 'voodoo doll')
shopModule:addSellableItem({'doll', 'doll'}, 2110, 400, 'doll')
shopModule:addSellableItem({'light shovel', 'light shovel'}, 5710, 300, 'light shovel')
shopModule:addSellableItem({'silver brooch', 'silver brooch'}, 2134, 150, 'silver brooch')
shopModule:addSellableItem({'scarab amulet', 'scarab amulet'}, 2135, 200, 'scarab amulet')
shopModule:addSellableItem({'ruby necklace', 'ruby necklace'}, 2133, 2000, 'ruby necklace')
shopModule:addSellableItem({'ring of the sky', 'ring of the sky'}, 2123, 30000, 'ring of the sky')
shopModule:addSellableItem({'platinum amulet', 'platinum amulet'}, 2171, 2500, 'platinum amulet')
shopModule:addSellableItem({'golden ring', 'golden ring'}, 2179, 8000, 'golden ring')
shopModule:addSellableItem({'glacier amulet', 'glacier amulet'}, 7888, 1500, 'glacier amulet')
shopModule:addSellableItem({'emerald bangle', 'emerald bangle'}, 2127, 800, 'emerald bangle')
shopModule:addSellableItem({'demonbone amulet', 'demonbone amulet'}, 2136, 32000, 'demonbone amulet')
shopModule:addSellableItem({'death ring', 'death ring'}, 6300, 1000, 'death ring')
shopModule:addSellableItem({'crystal ring', 'crystal ring'}, 2124, 250, 'crystal ring')
shopModule:addSellableItem({'crystal necklace', 'crystal necklace'}, 2125, 400, 'crystal necklace')
shopModule:addSellableItem({'ancient amulet', 'ancient amulet'}, 2142, 200, 'ancient amulet')
shopModule:addSellableItem({'spiked squelcher', 'spiked squelcher'}, 7452, 5000, 'spiked squelcher')
shopModule:addSellableItem({'relic sword', 'relic sword'}, 7383, 25000, 'relic sword')
shopModule:addSellableItem({'noble axe', 'noble axe'}, 7456, 6000, 'noble axe')
shopModule:addSellableItem({'nightmare blade', 'nightmare blade'}, 7418, 35000, 'nightmare blade')
shopModule:addSellableItem({'mystic blade', 'mystic blade'}, 7384, 30000, 'mystic blade')
shopModule:addSellableItem({'mercenary sword', 'mercenary sword'}, 7386, 12000, 'mercenary sword')
shopModule:addSellableItem({'heroic axe', 'heroic axe'}, 7389, 30000, 'heroic axe')
shopModule:addSellableItem({'guardian halberd', 'guardian halberd'}, 2427, 11000, 'guardian halberd')
shopModule:addSellableItem({'dreaded cleaver', 'dreaded cleaver'}, 7419, 10000, 'dreaded cleaver')
shopModule:addSellableItem({'demonrage sword', 'demonrage sword'}, 7382, 36000, 'demonrage sword')
shopModule:addSellableItem({'cranial basher', 'cranial basher'}, 7415, 30000, 'cranial basher')
shopModule:addSellableItem({'chaos mace', 'chaos mace'}, 7427, 12000, 'chaos mace')
shopModule:addSellableItem({'tortoise shield', 'tortoise shield'}, 6131, 150, 'tortoise shield')
shopModule:addSellableItem({'norse shield', 'norse shield'}, 7460, 1500, 'norse shield')
shopModule:addSellableItem({'spellbook of enlightenment', 'spellbook of enlightenment'}, 8900, 4000, 'spellbook of enlightenment')
shopModule:addSellableItem({'mammoth fur shorts', 'mammoth fur shorts'}, 7464, 850, 'mammoth fur shorts')
shopModule:addSellableItem({'skullcracker armor', 'skullcracker armor'}, 8889, 18000, 'skullcracker armor')
shopModule:addSellableItem({'paladin armor', 'paladin armor'}, 8891, 15000, 'paladin armor')
shopModule:addSellableItem({'glacier mask', 'glacier mask'}, 7902, 2500, 'glacier mask')
shopModule:addSellableItem({'glacier robe', 'glacier robe'}, 7897, 11000, 'glacier robe')
shopModule:addSellableItem({'glacier kilt', 'glacier kilt'}, 7896, 11000, 'glacier kilt')
shopModule:addSellableItem({'glacier shoes', 'glacier shoes'}, 7892, 2500, 'glacier shoes')
shopModule:addSellableItem({'lightning headband', 'lightning headband'}, 7901, 2500, 'lightning headband')
shopModule:addSellableItem({'lightning robe', 'lightning robe'}, 7898, 11000, 'lightning robe')
shopModule:addSellableItem({'lightning legs', 'lightning legs'}, 7895, 11000, 'lightning legs')
shopModule:addSellableItem({'lightning boots', 'lightning boots'}, 7893, 2500, 'lightning boots')
shopModule:addSellableItem({'magma monocle', 'magma monocle'}, 7900, 2500, 'magma monocle')
shopModule:addSellableItem({'magma coat', 'magma coat'}, 7899, 11000, 'magma coat')
shopModule:addSellableItem({'magma legs', 'magma legs'}, 7894, 11000, 'magma legs')
shopModule:addSellableItem({'magma boots', 'magma boots'}, 7891, 2500, 'magma boots')
shopModule:addSellableItem({'terra hood', 'terra hood'}, 7903, 2500, 'terra hood')
shopModule:addSellableItem({'terra mantle', 'terra mantle'}, 7884, 11000, 'terra mantle')
shopModule:addSellableItem({'terra legs', 'terra legs'}, 7885, 11000, 'terra legs')
shopModule:addSellableItem({'terra boots', 'terra boots'}, 7885, 2500, 'terra boots')
shopModule:addSellableItem({'hibiscus dress', 'hibiscus dress'}, 8873, 3000, 'hibiscus dress')
shopModule:addSellableItem({'ornamented axe', 'ornamented axe'}, 7411, 11000, 'ornamented axe')
shopModule:addSellableItem({'scarab shield', 'scarab shield'}, 2540, 2000, 'scarab shield')
shopModule:addSellableItem({'castle shield', 'castle shield'}, 2535, 5000, 'castle shield')
shopModule:addSellableItem({'medusa shield', 'medusa shield'}, 2536, 9000, 'medusa shield')
shopModule:addSellableItem({'demon shield', 'demon shield'}, 2520, 30000, 'demon shield')
shopModule:addSellableItem({'pirate knee breeches', 'pirate knee breeches'}, 5918, 200, 'pirate knee breeches')
shopModule:addSellableItem({'crocodile boots', 'crocodile boots'}, 3982, 1000, 'crocodile boots')
shopModule:addSellableItem({'fur boots', 'fur boots'}, 7457, 2000, 'fur boots')
shopModule:addSellableItem({'pirate boots', 'pirate boots'}, 5462, 3000, 'pirate boots')
shopModule:addSellableItem({'steel boots', 'steel boots'}, 2645, 30000, 'steel boots')
shopModule:addSellableItem({'krimhorn helmet', 'krimhorn helmet'}, 7461, 200, 'krimhorn helmet')
shopModule:addSellableItem({'ragnir helmet', 'ragnir helmet'}, 7462, 400, 'ragnir helmet')
shopModule:addSellableItem({'pirate hat', 'pirate hat'}, 6096, 1000, 'pirate hat')
shopModule:addSellableItem({'devil helmet', 'devil helmet'}, 2462, 1000, 'devil helmet')
shopModule:addSellableItem({'beholder helmet', 'beholder helmet'}, 3972, 7500, 'beholder helmet')
shopModule:addSellableItem({'skull helmet', 'skull helmet'}, 5741, 40000, 'skull helmet')
shopModule:addSellableItem({'pirate shirt', 'pirate shirt'}, 6095, 500, 'pirate shirt')
shopModule:addSellableItem({'leopard armor', 'leopard armor'}, 3968, 1000, 'leopard armor')
shopModule:addSellableItem({'mammoth fur cape', 'mammoth fur cape'}, 7463, 6000, 'mammoth fur cape')
shopModule:addSellableItem({'golden armor', 'golden armor'}, 2466, 20000, 'golden armor')
shopModule:addSellableItem({'dwarven armor', 'dwarven armor'}, 2503, 30000, 'dwarven armor')
shopModule:addSellableItem({'dragon scale mail', 'dragon scale mail'}, 2492, 40000, 'dragon scale mail')
shopModule:addSellableItem({'heavy machete', 'heavy machete'}, 2442, 90, 'heavy machete')
shopModule:addSellableItem({'daramanian mace', 'daramanian mace'}, 2439, 110, 'daramanian mace')
shopModule:addSellableItem({'mammoth whopper', 'mammoth whopper'}, 7381, 300, 'mammoth whopper')
shopModule:addSellableItem({'silver dagger', 'silver dagger'}, 2402, 500, 'silver dagger')
shopModule:addSellableItem({'taurus mace', 'taurus mace'}, 7425, 500, 'taurus mace')
shopModule:addSellableItem({'crystal sword', 'crystal sword'}, 7449, 600, 'crystal sword')
shopModule:addSellableItem({'furry club', 'furry club'}, 7432, 1000, 'furry club')
shopModule:addSellableItem({'daramanian waraxe', 'daramanian waraxe'}, 2440, 1000, 'daramanian waraxe')
shopModule:addSellableItem({'wyvern fang', 'wyvern fang'}, 7408, 1500, 'wyvern fang')
shopModule:addSellableItem({'brutetamers staff', 'brutetamers staff'}, 7379, 1500, 'brutetamers staff')
shopModule:addSellableItem({'beastslayer axe', 'beastslayer axe'}, 3962, 1500, 'beastslayer axe')
shopModule:addSellableItem({'dragonbone staff', 'dragonbone staff'}, 7430, 3000, 'dragonbone staff')
shopModule:addSellableItem({'diamond sceptre', 'diamond sceptre'}, 7387, 3000, 'diamond sceptre')
shopModule:addSellableItem({'lunar staff', 'lunar staff'}, 7424, 5000, 'lunar staff')
shopModule:addSellableItem({'sapphire hammer', 'sapphire hammer'}, 7437, 7000, 'sapphire hammer')
shopModule:addSellableItem({'amber staff', 'amber staff'}, 7426, 8000, 'amber staff')
shopModule:addSellableItem({'dragon slayer', 'dragon slayer'}, 7402, 15000, 'dragon slayer')
shopModule:addSellableItem({'war axe', 'war axe'}, 2453, 9000, 'war axe')
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local myNewPos = {
[1] = {x=32210, y=31157, z=7},
[2] = {x=32297, y=32831, z=7},
[3] = {x=32574, y=32752, z=7},
[4] = {x=33067, y=32880, z=6},
[5] = {x=33239, y=32483, z=7},
[6] = {x=33170, y=31810, z=6},
[7] = {x=32328, y=31782, z=7}
}
local TpTime = 30 --secs
local myLastTP = 0
local a = 1
function onThink()
if myLastTP == 0 then
myLastTP = os.time()
end
if os.difftime (os.time(), myLastTP) >= TpTime then
myLastTP = os.time()
doCreatureSay(getNpcCid(), "See you, Now Im going to the next city!", TALKTYPE_SAY)
doTeleportThing(getNpcCid(), myNewPos[a], FALSE)
if (a + 1) < 7 then
a = a + 1
else
a = 1
end
end
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('I don\t got all day!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
npcHandler:onThink()
end
and Gnomally Line 7 Attempt to call method 'Docreaturesay' a nil value
Line 7 >> function doCreatureSay(cid, type, msg) npcHandler:doCreatureSay(cid, type, msg) end
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function doCreatureSay(cid, type, msg) npcHandler:doCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local item = 'I\'m sorry, but you do not have the required items for this trade.'
local done = 'Here you are, thank you for your business.'
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'equipament') then
selfSay('You can here change some items for {gill gugel}, {gill coat}, {gill legs}, {spellbook of vigilance}, {prismatic armor}, {prismatic legs}, {prismatic boots}, {prismatic helmet}, {prismatic shield}, {Gnomish Voucher Type CA1}, {Gnomish Voucher Type CA2}, {Gnomish Voucher Type MA1}, {Gnomish Voucher Type MA2}.', cid)
elseif msgcontains(msg, 'gill coat') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me the 10 major crystalline token?', cid)
talk_state = 1
else
selfSay('I need a {10 major crystalline token}, to give you one Gill Coat. Please come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,18422) >= 10 then
if doPlayerRemoveItem(cid,18423, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 18399, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'gill gugel') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me the 10 major crystalline token?', cid)
talk_state = 2
else
selfSay('I need a {10 major crystalline token}, to give you the Gill Gugel. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 1 then
if doPlayerRemoveItem(cid,18423,10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid,18398,1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'gill legs') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline token ?', cid)
talk_state = 3
else
selfSay('I need {10 major crystalline token}, to give you the Gill Legs. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 1 then
if doPlayerRemoveItem(cid,18423,10) == TRUE then
doPlayerAddItem(cid,18400,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'spellbook of vigilance') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline token?', cid)
talk_state = 4
else
selfSay('I need {10 major crystalline token}, to give you the Spellbook of Vigilance. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 4 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 10 then
for i = 1, 4 do
doPlayerRemoveItem(cid, 18423, 10)
end
doPlayerAddItem(cid,18401,1)
selfSay(done, cid)
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'prismatic helmet') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline tokens?', cid)
talk_state = 5
else
selfSay('I need {10 major crystalline tokens}, to give you the Prismatic Helmet. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 5 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 10 then
for i = 1, 4 do
doPlayerRemoveItem(cid, 18423, 10)
end
doPlayerAddItem(cid,18403,1)
selfSay(done, cid)
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'prismatic armor') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline tokens?', cid)
talk_state = 6
else
selfSay('I need {10 major crystalline tokens}, to give you the Prismatic Armor. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 6 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 20 then
doPlayerRemoveItem(cid,18423,20)
doPlayerAddItem(cid,18404,1)
selfSay(done, cid)
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'prismatic legs') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline tokens?', cid)
talk_state = 7
else
selfSay('I need a {10 major crystalline tokens}, to give you the Prismatic Legs. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 7 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 10 then
if doPlayerRemoveItem(cid,18423,10) == TRUE then
doPlayerAddItem(cid,18405,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'prismatic boots') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me 10 major crystalline tokens?', cid)
talk_state = 8
else
selfSay('I need a {10 major crystalline tokens}, to give you the Prismatic Boots. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 8 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 10 then
if doPlayerRemoveItem(cid,18423,10) == TRUE then
doPlayerAddItem(cid,18406,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'prismatic shield') then
if getPlayerItemCount(cid,18423) >= 10 then
selfSay('Did you bring me the 10 major crystalline tokens?', cid)
talk_state = 9
else
selfSay('I need a {10 major crystalline tokens}, to give you the Prismatic Shield. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 9 then
talk_state = 0
if getPlayerItemCount(cid,18423) >= 10 then
for i = 1, 2 do
doPlayerRemoveItem(cid, 18423, 10)
end
doPlayerAddItem(cid,18410,1)
selfSay(done, cid)
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'Gnomish Voucher Type CA1') then
if getPlayerItemCount(cid,18422) >= 70 then
selfSay('Did you bring me the 70 minor crystalline tokens?', cid)
talk_state = 10
else
selfSay('I need a {70 minor crystalline tokens}, to give you the Gnomish Voucher Type CA1. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 10 then
talk_state = 0
if getPlayerItemCount(cid,18422) >= 70 then
if doPlayerRemoveItem(cid,18422,70) == TRUE then
doPlayerAddItem(cid,18521,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'Gnomish Voucher Type CA2') then
if getPlayerItemCount(cid,18422) >= 70 then
selfSay('Did you bring me 70 minor crystalline tokens?', cid)
talk_state = 11
else
selfSay('I need a {70 minor crystalline tokens}, to give you the Gnomish Voucher Type CA2. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 11 then
talk_state = 0
if getPlayerItemCount(cid,18422) >= 70 then
if doPlayerRemoveItem(cid,18422,70) == TRUE then
doPlayerAddItem(cid,18522,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'Gnomish Voucher Type MA1') then
if getPlayerItemCount(cid,18422) >= 70 then
selfSay('Did you bring me the 70 minor crystalline tokens?', cid)
talk_state = 12
else
selfSay('I need a {70 minor crystalline tokens}, to give you the Gnomish Voucher Type MA1. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 12 then
talk_state = 0
if getPlayerItemCount(cid,18422) >= 70 then
if doPlayerRemoveItem(cid,18422,70) == TRUE then
doPlayerAddItem(cid,18518,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'Gnomish Voucher Type MA2') then
if getPlayerItemCount(cid,18422) >= 70 then
selfSay('Did you bring me the 70 minor crystalline tokens?', cid)
talk_state = 13
else
selfSay('I need a {70 minor crystalline tokens}, to give you the Gnomish Voucher Type MA2. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 13 then
talk_state = 0
if getPlayerItemCount(cid,18422) >= 70 then
if doPlayerRemoveItem(cid,18422,70) == TRUE then
doPlayerAddItem(cid,18519,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'suahudsak') then
if getPlayerItemCount(cid,18423) >= 50 then
selfSay('Did you bring me the 50 major crystalline tokens?', cid)
talk_state = 14
else
selfSay('I need a {50 major crystalline tokens}, to give you the Gnomish Voucher Type MA2020202. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 14 then
talk_state = 0
if getPlayerItemCount(cid,0) >= 50 then
if doPlayerRemoveItem(cid,0,50) == TRUE then
doPlayerAddItem(cid,0,1)
selfSay(done, cid)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and talk_state >= 1 and talk_state <= 15 then
selfSay('Well, then leave.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If anyone can help me with this will be great and ill be grateful
Kind Regards
YisusChrist