Ir para conteúdo

Featured Replies

Postado

E ae galera, não sei se eta no local certo.

Eu queria a script de um npc que você possa alugar uma mount por um certo numero e coins, valendo rep+

Web Master 100%

Scripter 20%

Spriter 20%

Mapper 5%

Hoster 0%

Postado

Créditos: Vodkart

Em Mods:

AluguelMount.xml


<?xml version="1.0" encoding="UTF-8"?> 

<mod name="Aluguel Mounts" version="1.0" author="Vodkart" contact="#####.com" enabled="yes"> 

<config name="aluguel_func"><![CDATA[

Aluguel_mounts = {

["war horse"] = {price = 10000, days = 2, mountid = 17, level = 10, premium = false, storage = 500561},

["fire war horse"] = {price = 30000, days = 1, mountid = 23, level = 20, premium = false, storage = 500562},

["sandstone scorpion"] = {price = 50000, days = 1, mountid = 21, level = 30, premium = true, storage = 500563}

}

function doRemovePlayerMount(cid, mountId)

doPlayerRemoveMount(cid, mountId)

return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead =  getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})

end

function CheckRentMount(cid)

for var, ret in pairs(Aluguel_mounts) do

if canPlayerRideMount(cid, ret.mountid) and getPlayerStorageValue(cid, ret.storage) ~= -1 and getPlayerStorageValue(cid, ret.storage) <= os.time() then

doRemovePlayerMount(cid, ret.mountid)

doPlayerSendTextMessage(cid,18,"O tempo da sua montaria "..var.." acabou, para adquirir ela novamente volte ao npc.")

end

end

end

]]></config>

<globalevent name="CheckMount" interval="60000" event="script"><![CDATA[

domodlib('aluguel_func')

function onThink(interval, lastExecution)

local on = getPlayersOnline()

if #on > 0 then

for i = 1, #on do

CheckRentMount(on[i])

end

end

return true

end]]></globalevent>

</mod>

obs: Checar duas coisas em mods, primeira: Se a função que checa se tem a mount é 'canPlayerRideMount' ou 'getPlayerMount', caso for 'getPlayerMount' trocar: canPlayerRideMount(cid, ret.mountid) por: getPlayerMount(cid, ret.mountid) segunda: o intervalo de tempo na tag do globalevents, no meu server era em mile segundos: interval="60000" -- caso o seu não seja em mile segundos troque 60000 por 60. Data/Npc Peach.xml

<?xml version="1.0"?>

<npc name="Peach" script="data/npc/scripts/aluguelmounts.lua" walkinterval="50000" floorchange="0">

<health now="1000" max="1000"/>

<look type="130" head="0" body="114" legs="114" feet="0" addons="0"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|. You want to {rent} a {mount}?"/>

</parameters>

</npc>

Data/Npc/Script aluguelmounts.lua

domodlib('aluguel_func')

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 msg = string.lower(msg)

if isInArray({'aluguel','alugar', 'rent', 'mounts', 'mount'}, msg) then

npcHandler:say("Você pode comprar {war horse}, {fire war horse} e {sandstone scorpion}!", cid)

talkState[talkUser] = 1

elseif talkState[talkUser] == 1 then

if Aluguel_mounts[msg] then

if Aluguel_mounts[msg].premium == true and not isPremium(cid)  then

npcHandler:say('Você precisa ser premium para alugar essa montaria.', cid) return true

elseif getPlayerLevel(cid) < Aluguel_mounts[msg].level then

npcHandler:say('você precisa ter level ' .. Aluguel_mounts[msg].level .. ' ou mais para alugar essa montaria.', cid) return true

elseif getPlayerStorageValue(cid, Aluguel_mounts[msg].storage) >= os.time() then

npcHandler:say('você já alugou essa montaria!', cid) return true

end

name,price,stor,days,mountid = msg,Aluguel_mounts[msg].price,Aluguel_mounts[msg].storage,Aluguel_mounts[msg].days,Aluguel_mounts[msg].mountid

npcHandler:say('Você quer alugar a montaria '..name..' por '..days..' dia'..(days > 1 and 's' or '')..' no preço de '..price..' gps? {yes}', cid)

talkState[talkUser] = 2

else

npcHandler:say('Desculpe, eu não vendo essa montaria.', cid)

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then

if doPlayerRemoveMoney(cid, price)  then

doPlayerAddMount(cid, mountid)

setPlayerStorageValue(cid, stor, os.time()+days*86400)

npcHandler:say('Aqui está sua montaria '..name..', ela irá durar até '..os.date("%d %B %Y %X", getPlayerStorageValue(cid,stor))..'.', cid)

else

npcHandler:say('você não tem dinheiro suficiente para alugar a montaria!', cid)

talkState[talkUser] = 0 

end

elseif msg == "no" then 

selfSay("Then not", cid) 

talkState[talkUser] = 0 

npcHandler:releaseFocus(cid) 

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Configuração:

Em mods tem uma tabela chamada 'Aluguel_mounts'

  Citar

Aluguel_mounts = {

["war horse"] = {price = 10000, days = 2, mountid = 17, level = 10, premium = false, storage = 500561},

["fire war horse"] = {price = 30000, days = 1, mountid = 23, level = 20, premium = false, storage = 500562},

["sandstone scorpion"] = {price = 50000, days = 1, mountid = 21, level = 30, premium = true, storage = 500563}

}

["war horse"] dentro dos [""] fica o nome da montaria, em minusculo o nome da montaria

price = 10000 -- preço que vai custar para alugar

days = 2 -- por quantos dias ele vai alugar a montaria

mountid = 17 -- é o id da montaria, você olha em mounts.xml

level = 10 -- level que precisa para alugar a montaria

premium = false -- se precisa ser premium, true ou false.

storage = 500561 -- storage você coloca uma aleatória, ex: 500565 obs: não pode repetir a storage

Versão testada: 9.1

Descrição: É um npc simples que tem como função alugar determinadas montarias por certo tempo, dias para ser exato.

------------------------------------

Esse script tem em outro forum, nao sei se aqui no tibia king tem também, é so procurar brow, espero ter ajudado ^^

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo