Ok, você já adicionou essas functions na lib? Se sim, oque o NPC vai vender?
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

info
Grupo: Visconde
Registrado: 10/02/11
Posts: 377
Reputação: +78

só queria um exemplo
dele vender uma sword
e vendendo um outfit
q ai tendo a base eu me viro com o resto =)
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

data/npc, crie um arquivo chamado PointsOutfit.xml, adicione isso dentro:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dimral" script="pointsoutfit.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell items for Points"/>
</parameters>
</npc>
Em data/npc/scripts, crie pointsoutfit.lua e adicione dentro:
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)
local price = 2
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) then
selfSay("Hi, Im a new NPC, i sell items for Points! Say 'sword' to buy", cid)
talkState[talkUser] = 1
if msgcontains(msg, 'yes') or msgcontains(msg, 'sword') then
if getPlayerPoints(cid) >= price then
if doPlayerRemovePoints(cid, price) then
doPlayerAddItem(cid,2148,100)
selfSay('Congratulations! I sell the sword
', cid)
end
return true
end
end
talkState[talkUser] = 0
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Um simples exemplo aonde você fala hi,sword, ai verifica se tem Points suficientes (configurável no local "price" destacado de vermelho) e remove os points, dps adiciona 1kk ;D Testa ai
Editado Março 5 por Roksas
info
Grupo: Visconde
Registrado: 10/02/11
Posts: 377
Reputação: +78

vlw pode mover ja =)
eu tenho um npc q vende outfit aqui eu acho q ja consigo mudar isso
vlw mesmo +rep
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Qualquer coisa só pedir haha, dúvida sanada - reported.




info
Grupo: Visconde
Registrado: 10/02/11
Posts: 377
Reputação: +78
to querendo um npc
q as coisas nele n custe gps
e sim ppoints
o cara colocou isso
pra criar mas eu n tenho ideia da onde colocar isso no npc
alguem ajuda ai =)