Troca por isso
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local outs = {
--[nome da outfit] = {sto, {id male, id female}}
["jamaican"] = {181601, {m = 587, f = 588}},
["rapper"] = {181602, {m = 545, f = 512}},
["oriental"] = {181603, {m = 585, f = 586}},
["adventurer"] = {181605, {m = 494, f = 495}},
["bussines"] = {181606, {m = 1419, f = 513}},
["atletic"] = {181607, {m = 516, f = 517}},
["punk"] = {181608, {m = 518, f = 519}},
["mercenary"] = {181610, {m = 522, f = 524}},
["hiker"] = {181611, {m = 523, f = 525}},
}
msg = string.lower(msg)
local outfit = ""
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary e Hiker}, which outfit do you want??", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want buy that outfit?", cid)
outfit = msg
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outs[outfit][1]) <= 0 then
if getPlayerPremiumDays(cid) > 0 then
if getPlayerMoney(cid) >= 20000 then
if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
doPlayerAddOutfit(cid, outs[outfit][2].f, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
else
doPlayerAddOutfit(cid, outs[outfit][2].m, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
end
else
selfSay("You need 200dl to buy this outfit!", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("You already have this outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
end
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
E pra por spoiler usa isso
[spoiler.]
SCRIPT
[/spoiler.]
SEM OS pontos '-'





info
Grupo: Artesão
Registrado: 28/09/12
Posts: 106
Reputação: +1
quando o player tenta comprar um outfit... da o seguinte erro no server....
ele faz todo o processo... escolhe o outfit e quando fala sim para confirmar, não acontece nada.
30/10/2012 23:43:15] [Error - Npc interface]
[30/10/2012 23:43:15] data/npc/scripts/clothes.lua:onCreatureSay
[30/10/2012 23:43:15] Description:
[30/10/2012 23:43:15] data/npc/scripts/clothes.lua:40: attempt to index field '?' (a nil value)
[30/10/2012 23:43:15] stack traceback:
[30/10/2012 23:43:15] data/npc/scripts/clothes.lua:40: in function 'callback'
[30/10/2012 23:43:15] data/npc/lib/npcsystem/npchandler.lua:391: in function 'onCreatureSay'
[30/10/2012 23:43:15] data/npc/scripts/clothes.lua:7: in function <data/npc/scripts/clothes.lua:7>
o script é o tal:
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local outs = {
--[nome da outfit] = {sto, {id male, id female}}
["jamaican"] = {181601, {m = 587, f = 588}},
["rapper"] = {181602, {m = 545, f = 512}},
["oriental"] = {181603, {m = 585, f = 586}},
["adventurer"] = {181605, {m = 494, f = 495}},
["bussines"] = {181606, {m = 1419, f = 513}},
["atletic"] = {181607, {m = 516, f = 517}},
["punk"] = {181608, {m = 518, f = 519}},
["mercenary"] = {181610, {m = 522, f = 524}},
["hiker"] = {181611, {m = 523, f = 525}},
}
msg = string.lower(msg)
local outfit = ""
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary e Hiker}, which outfit do you want??", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want buy that outfit?", cid)
outfit = msg
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outs[outfit][1]) <= 0 then
if getPlayerPremiumDays(cid) > 0 then
if getPlayerMoney(cid) >= 20000 then
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid, outs[outfit][2].f, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
else
doPlayerAddOutfit(cid, outs[outfit][2].m, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
end
else
selfSay("You need 200dl to buy this outfit!", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("You already have this outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
end
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Aproveitem e me expliquem como eu coloco o /\ como spoiler... para não ficar grande aki...