Eu to fazendo um npc que em vez dele cobrar por gps ele cobra por "mudin coins" (vai ser a moeda do jogo)
só q eu percebi q se vc tem as mudins coins nessessarias que são 10, ele recolhe as 10 coins e te da o item até agora normal
Mais se vc n tiver a moeda ele tb da o item vo posta o scripter dele
se alguem puder mi ajudar mi mandando o certo ou mi disendo oq tenho q mudar agradeço.
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. ' !Oi eu vendo os itens de evento!! Por Mudin coins')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'life') then
selfSay('Voce quer compra um life ring por 10 coins?')
talk_state = 1
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,2159,10) then
setPlayerStorageValue(cid,2159,10)
doPlayerAddItem(cid,6301,1)
setPlayerStorageValue(cid,2159,10)
selfSay('Desculpe, voce precisa de 10 mudin coins.')
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
info
Group: Campones
Joined: 10/06/07
Posts: 44
Reputation: +1
Eu to fazendo um npc que em vez dele cobrar por gps ele cobra por "mudin coins" (vai ser a moeda do jogo)
só q eu percebi q se vc tem as mudins coins nessessarias que são 10, ele recolhe as 10 coins e te da o item até agora normal
Mais se vc n tiver a moeda ele tb da o item vo posta o scripter dele
se alguem puder mi ajudar mi mandando o certo ou mi disendo oq tenho q mudar agradeço.
local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. creatureGetName(cid) .. ' !Oi eu vendo os itens de evento!! Por Mudin coins') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'life') then selfSay('Voce quer compra um life ring por 10 coins?') talk_state = 1 elseif talk_state == 1 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,2159,10) then setPlayerStorageValue(cid,2159,10) doPlayerAddItem(cid,6301,1) setPlayerStorageValue(cid,2159,10) selfSay('Desculpe, voce precisa de 10 mudin coins.') end end talk_state = 0 elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end