BR

[Encerrado] (Pedido) Npc

Por BrunooMaciell, 13 de dez. de 2013 em Tópicos Sem Resposta

pedido - poketibia
resolvido
8
1.1k
BrunooMaciellB
13 de dezembro de 2013 às 21:09

Estou aqui pra fazre um pedido relacionado a npc travel !!

 

NPC

 

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

if(msgcontains(msg, 'ticket')) then
if getPlayerMoney(cid) >= 500 then
selfSay('You want to buy 1 travel ticket?, it cost 5 dollars', cid)
talkState[talkUser] = 1
else
selfSay('You don\'t have enough money, it cost 5 dollars.', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if doPlayerRemoveMoney(cid, 500) == TRUE then
setPlayerStorageValue(cid, 4592, 1)
selfSay('Here is your ticket, it can not be transfere, when you have used the ticket at the boat, it can not be used again, go to the boat to use it.', cid)
end
end
return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Eu queria que o cara que for usa este npc ele tem que este com o pokemon dentro da ball !!

 

q quem for mi ajuda se possivelmente puter posta a linha pois tem +3 npcs assim dai eu ia adicionar nos outros 3 ^^

 

Curti++

WarbyW
13 de dezembro de 2013 às 22:00

Bruno Maciel,

Peguei uma pequena linha do Script da Bike no PDA do Slicer.

if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "Return your pokemon.")
end

Já que eu não entendo quase nada de Script, tente colocar isso no topo do comando, qualquer erro meu me corrija por favor.

@Edit

Não esqueça de fazer um Backup de seu arquivo!.

Editado Dezembro 13 por Warby

BrunooMaciellB
13 de dezembro de 2013 às 22:06

tipo esta tag pode ate funciona porem tem que sabe o lugar certo da script pra add pra nao da erro de linha !!

WarbyW
13 de dezembro de 2013 às 22:19

Bruno,

Pegue a script da Bike inteira e tente onde você acha. Como eu disse acima, sou novo em Scriptings.

local function BikeSpeedOn(cid, t)

setPlayerStorageValue(cid, t.s, t.speed)
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, t.speed)
end
local function BikeSpeedOff(cid, t)
setPlayerStorageValue(cid, t.s, -1)
doRegainSpeed(cid)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getThingPos(cid)
local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 500}
if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "Return your pokemon.")
end
if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or
getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or
getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then --alterado v2.9
return doPlayerSendCancel(cid, "You can't do that right now.")
end
if getPlayerStorageValue(cid, t.s) <= 0 then
doSendMagicEffect(pos, 177)
doCreatureSay(cid, t.text, 19)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted in a bike.')
BikeSpeedOn(cid, t)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 1394}, -1)
else
doSetCreatureOutfit(cid, {lookType = 1393}, -1)
end
else
doSendMagicEffect(pos, 177)
doCreatureSay(cid, t.dtext, 19)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted of a bike.')
BikeSpeedOff(cid, t)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
return true
end



Creio que seja no topo do comando.

zipter98Z
13 de dezembro de 2013 às 22:22

Tenta assim:

 

 

 

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
 
    if(msgcontains(msg, 'ticket')) then
        if getPlayerMoney(cid) >= 500 then
            selfSay('You want to buy 1 travel ticket?, it cost 5 dollars', cid)
            talkState[talkUser] = 1
        else
            selfSay('You don\'t have enough money, it cost 5 dollars.', cid)
        end
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if #getCreatureSummons(cid) >= 1 then
            selfSay("Retorne seu pokémon para a pokeball, antes...")
            talkState[talkUser] = 1
            return true
        elseif doPlayerRemoveMoney(cid, 500) == TRUE then
            setPlayerStorageValue(cid, 4592, 1)
            selfSay('Here is your ticket, it can not be transfere, when you have used the ticket at the boat, it can not be used again, go to the boat to use it.', cid)
        end
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

BrunooMaciellB
14 de dezembro de 2013 às 14:42

Vlw ^^

 

Curti++

zipter98Z
14 de dezembro de 2013 às 15:44

Tópico movido para a seção de dúvidas e pedidos resolvidos.

4 anos depois...
StigalS
21 de abril de 2018 às 03:15
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.