Obsdark
Member
- Joined
- Sep 25, 2011
- Messages
- 213
- Reaction score
- 9
¡¡¡Hey Oh!!!
I wanna know if somebody can help me fixing this NPC, it must change one weapon, some ammounts of certain item and some ammounts of gold and in exchange give you another weapon.
The script used to work, but then i added support to "another languaje" like you can see in the second part of the script, and now doesn't say nothing more than the content of the firsts "if" of each languaje, this are the ones who active with "Esp" and "Eng" respectibly.
Some of you think know how can i fix it?
¡Tnx from now!
¡Bless you and Cheers up!
(Y)(Y)
-Obsdark-
I wanna know if somebody can help me fixing this NPC, it must change one weapon, some ammounts of certain item and some ammounts of gold and in exchange give you another weapon.
The script used to work, but then i added support to "another languaje" like you can see in the second part of the script, and now doesn't say nothing more than the content of the firsts "if" of each languaje, this are the ones who active with "Esp" and "Eng" respectibly.
Some of you think know how can i fix it?
LUA:
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 onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local v = {
["Dagger"] = {110, 11, 2376, 2379}, -- iron, gold, New Weapon, Weapon you have
["Sword"] = {120, 12, 2383, 2376}
}
function creatureSayCallback(cid, type, msg)
local s = getPlayerItemCount
local msgn = "Lo lamento, pero no tienes los materiales suficientes ;)."
local msge = "i'm sorry, but u don't have enough materials to do that ;)."
local msgp = "Lo lamento, pero no tienes los materiales suficientes ;)."
if (msgcontains(msg,'Esp')) then
npcHandler:say("Bueno, ¿Que buscas?, [Refinar] [Comprar] [Vender]", cid)
if (msgcontains(msg,'Refinar')) and s(cid,2148) == 0 and s(cid,115) == 0 then
npcHandler:say('AJUaJU, No tienes ni oro ni iron.. Consigue algunas monedas y luego regresas, ¿Quieres? ;)', cid)
elseif (msgcontains(msg,'Refinar')) and s(cid,115) == 0 and s(cid,2148) > 0 then
npcHandler:say('¡No tienes iron! Consigue algo y luego regresa ;)', cid)
elseif (msgcontains(msg,'Refinar')) and s(cid,2148) == 0 and s(cid,115) > 0 then
npcHandler:say('¡No tienes oro! Consigue algunas monedas y luego regresas, ¿Quieres? ;)', cid)
elseif (msgcontains(msg,'Refinar')) and s(cid,2148) >= 10 and s(cid,115) >= 110 then
npcHandler:say('¡Y bueno!, ¿que deseas refinar? ;)', cid)
for txt, v in pairs(v) do
if (msgcontains(msg, txt)) and s(cid,115) ~= v[1] and s(cid,2148) >= v[2] then
npcHandler:say('No tienes iron suficiente... Consigue algo mas y luego regresa ;)', cid)
elseif msgcontains(msg, txt) and s(cid,2148) ~= v[2] and s(cid,115) >= v[1] then
npcHandler:say('¿No tienes oro? Consigue algunas monedas y luego regresa, encantado te refinare el item cuando lo hagas. ;)', cid)
elseif msgcontains(msg, txt) and s(cid,2148) >= v[2] and s(cid,115) >= v[1] and s(cid,v[4]) < 1 then
npcHandler:say('No trajiste el arma para refinarla... Traela contigo primero y entonces podré hacerlo. ;)', cid)
end
end
for txt, v in pairs(v) do
if (msgcontains(msg, txt)) then
if doPlayerRemoveItem(cid,115,v[1]) then
if doPlayerRemoveMoney(cid, v[2]) then
if doPlayerRemoveItem(cid,v[4],1) then
doPlayerAddItem(cid,v[3],1)
npcHandler:say("Aqui tienes tu ".. getItemNameById(v[3]) .."!", cid)
else
npcHandler:say("".. msgn .."", cid)
end
end
end
end
end
end
end
if (msgcontains(msg,'Eng')) then
npcHandler:say("Well, what do you want?, [Refine] [Buy] [Sell]", cid)
if (msgcontains(msg,'Refine')) and s(cid,115) == 0 and s(cid,2148) == 0 then
npcHandler:say("AuAJu You don't have Neither iron and money, Get some of them and then come back, ;)", cid)
elseif (msgcontains(msg,'Refine')) and s(cid,115) == 0 and s(cid,2148) > 0 then
npcHandler:say("¡You don't have Iron! Get some and then come back ;)", cid)
elseif (msgcontains(msg,'Refine')) and s(cid,2148) == 0 and s(cid,115) > 0 then
npcHandler:say("¡You don't have any gold! Get some coins and then come back Would ya? ;)", cid)
elseif (msgcontains(msg,'Refine')) and s(cid,2148) >= 10 and s(cid,115) >= 110 then
npcHandler:say("¡Exelent!, What you wish to refine?", cid)
for txt, v in pairs(v) do
if (msgcontains(msg, txt)) and s(cid,115) ~= v[1] and s(cid,2148) >= v[2] then
npcHandler:say("You don't have enough iron, get some more and then come back ;)", cid)
elseif (msgcontains(msg, txt)) and s(cid,2148) ~= v[2] and s(cid,115) >= v[1] then
npcHandler:say("You don't have gold? get some more coins and then i'll be really happy of refine your weapon ;)", cid)
elseif (msgcontains(msg, txt)) and s(cid,2148) >= v[2] and s(cid,115) >= v[1] and s(cid,v[4]) < 1 then
npcHandler:say("You didn't bring the weapon with you... Bring it with you first and then i think i can refine it for you ;)", cid)
end
end
for txt, v in pairs(v) do
if (msgcontains(msg, txt)) then
if doPlayerRemoveItem(cid,115,v[1]) then
if doPlayerRemoveMoney(cid, v[2]) then
if doPlayerRemoveItem(cid,v[4],1) then
doPlayerAddItem(cid,v[3],1)
npcHandler:say("Here you have your ".. getItemNameById(v[3]) .."!", cid)
else
npcHandler:say("".. msge .."", cid)
end
end
end
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
¡Tnx from now!
¡Bless you and Cheers up!
(Y)(Y)
-Obsdark-