Ir para conteúdo

Npc - Saffari Zone Automático!


Crypter

Posts Recomendados



È um sistema para poketibia que serio o Saffari totalmente automático.




 




[+] O jogador não perde level(experience) ao morrer.




[+] O jogador é teleportado quando acabar o tempo ou quando suas Saffari balls acabar!




[+] Mostra o tempo restante num comando exclusivo !saffari time




 




ECewoTP.jpg




 




 




 




Pasta mods




 




Saffari.xml




<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Saffari" version="2.0" author="Vodkart" contact="none.com" enabled="yes">
<config name="saffari_func"><![CDATA[
config
= {
price
= 5000,
level
= 50,
need_premium
= false,
minutes
= 60,
saffari_positions
= {enter = {x=152,y=51,z=5}, exit = {x=163,y=51,z=5}},
saffari_balls
= {11445,30}, -- itemid e quantidade
blocked_pokeballs
= {2146, 2147, 11437, 11441, 11445}, -- pokeball, ultraball, greatball, masterball, safarriball
storages
= {874547,874548} -- start, time
}
function timeString
(timeDiff)
local dateFormat
= {
{"day", timeDiff / 60 / 60 / 24},
{"hour", timeDiff / 60 / 60 % 24},
{"minute", timeDiff / 60 % 60},
{"second", timeDiff % 60}
}
local out
= {}
for k, t in ipairs(dateFormat) do
local v
= math.floor(t[2])
if(v > 0) then
table
.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
end
end
local ret
= table.concat(out)
if ret:len() < 16 and ret:find("second") then
local a
, b = ret:find(" and ")
ret
= ret:sub(b+1)
end

return ret
end

]]></config>
<event type="login" name="SaffariRegister" event="script"><![CDATA[
function onLogin
(cid)
registerCreatureEvent
(cid, "SaffariDeath")
return true
end
]]></event>
<talkaction words="/saffari;!saffari" event="buffer"><![CDATA[
domodlib
('saffari_func')
param
= string.lower(param)
if getPlayerStorageValue(cid, config.storages[1]) <= 0 then
doPlayerSendTextMessage
(cid, MESSAGE_STATUS_CONSOLE_BLUE,"you are not in Saffari") return true
end
if (param == "") then
doPlayerSendTextMessage
(cid, MESSAGE_STATUS_CONSOLE_BLUE,"invalid command, enter !saffari time or !safari leave") return true
elseif isInArray
({"time","tempo"}, param) then
doPlayerSendTextMessage
(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (getPlayerStorageValue(cid, config.storages[2]) - os.time() > 0 and "Left "..timeString(getPlayerStorageValue(cid, config.storages[2]) - os.time()).."" or "Time is over. Please wait a moment.").."\nTo leave enter command: !saffari leave") return true
elseif isInArray
({"sair","leave"},param) then
doTeleportThing
(cid, config.saffari_positions.exit)
setPlayerStorageValue
(cid, config.storages[1], 0)
setPlayerStorageValue
(cid, config.storages[2], 0)
doPlayerSendTextMessage
(cid,22,'you left the saffari zone.') return true
end
]]></talkaction>
<globalevent name="SaffariCheck" interval="60" event="script"><![CDATA[
domodlib
('saffari_func')
function onThink
(interval, lastExecution)
local on
= getPlayersOnline()
if #on > 0 then
for i = 1, #on do
if getPlayerStorageValue(on[i], config.storages[1]) > 0 then
if getPlayerItemCount(on[i], config.saffari_balls[1]) <= 0 or getPlayerStorageValue(on[i], config.storages[2]) - os.time() <= 0 then
doTeleportThing
(on[i], config.saffari_positions.exit)
setPlayerStorageValue
(on[i], config.storages[1], 0)
setPlayerStorageValue
(on[i], config.storages[2], 0)
doPlayerSendTextMessage
(on[i],22,'you left the saffari zone.')
end
end
end
end
return true
end
]]></globalevent>
<event type="death" name="SaffariDeath" event="script"><![CDATA[
domodlib
('saffari_func')
function onDeath
(cid, corpse, deathList)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storages[1]) >= 1 then
setPlayerStorageValue
(cid, config.storages[1], 0)
setPlayerStorageValue
(cid, config.storages[2], 0)
doPlayerSetLossPercent
(cid, PLAYERLOSS_EXPERIENCE, 0)
end
return true
end
]]></event>
</mod>



 




 




NPC




 




 




Saffari Man.xml




<?xml version="1.0"?>
<npc name="Saffari Man" script="data/npc/scripts/saffari.lua" walkinterval="50000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="95" body="116" legs="121" feet="115" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. You want to {enter} in the {saffari} zone!" />
</parameters>
</npc>



 




saffari.lua




domodlib('saffari_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
,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower()
if isInArray({"saffari","enter","entrar"}, msg) then
npcHandler
:say('you can stay in the Saffari zone by '..config.minutes..' minutes, the price is '..config.price..' gp(s), You want enter? {yes}', cid)
talkState
[talkUser] = 1
elseif msgcontains
(msg, 'yes') and talkState[talkUser] == 1 then
for i = 1, #config.blocked_pokeballs do
if getPlayerItemCount(cid, config.blocked_pokeballs[i]) >= 1 then
npcHandler
:say('Keep your '..getItemNameById(config.blocked_pokeballs[i])..'!', cid) return true
end
end
if config.need_premium and not isPremium(cid) then
npcHandler
:say('Sorry, you need to be premium!', cid) return true
elseif getPlayerLevel
(cid) < config.level then
npcHandler
:say('Sorry, you must be at least level '..config.level..' to enter the Saffari zone!', cid) return true
elseif not doPlayerRemoveMoney
(cid, config.price) then
npcHandler
:say('Sorry, you do not have enough money!', cid) return true
end
doPlayerAddItem
(cid, config.saffari_balls[1], config.saffari_balls[2])
selfSay
("Thanks, you've been teleported to the Saffari zone and has "..config.minutes.." minutes, if you want to leave enter {!saffari leave}.", cid)
doTeleportThing
(cid, config.saffari_positions.enter)
setPlayerStorageValue
(cid, config.storages[1], 1)
setPlayerStorageValue
(cid, config.storages[2], os.time()+config.minutes*60)
elseif msg
== "no" and talkState[talkUser] >= 1 then
selfSay
("then ok.", cid)
talkState
[talkUser] = 0
npcHandler
:releaseFocus(cid)
end
return true
end
npcHandler
:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler
:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 3 years later...
Em 27/02/2017 em 21:05, Crypter disse:
 


È um sistema para poketibia que serio o Saffari totalmente automático.

 


 

 


[+] O jogador não perde level(experience) ao morrer.

 


[+] O jogador é teleportado quando acabar o tempo ou quando suas Saffari balls acabar!

 


[+] Mostra o tempo restante num comando exclusivo !saffari time

 


 

 


ECewoTP.jpg

 


 

 


 

 


 

 


Pasta mods

 


 

 


Saffari.xml



 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Saffari" version="2.0" author="Vodkart" contact="none.com" enabled="yes"> 
<config name="saffari_func"><![CDATA[

config = {

	price = 5000,

	level = 50,

	need_premium = false,

	minutes = 60,

	saffari_positions = {enter = {x=152,y=51,z=5}, exit = {x=163,y=51,z=5}},

	saffari_balls = {11445,30}, -- itemid e quantidade

	blocked_pokeballs = {2146, 2147, 11437, 11441, 11445}, -- pokeball, ultraball, greatball, masterball, safarriball 

	storages = {874547,874548} -- start, time
}

function timeString(timeDiff)

	local dateFormat = {
{"day", timeDiff / 60 / 60 / 24},
{"hour", timeDiff / 60 / 60 % 24},
{"minute", timeDiff / 60 % 60},
{"second", timeDiff % 60}
}

	local out = {}
for k, t in ipairs(dateFormat) do

		local v = math.floor(t[2])
if(v > 0) then

			table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))

		end

	end

	local ret = table.concat(out)
if ret:len() < 16 and ret:find("second") then

		local a, b = ret:find(" and ")

		ret = ret:sub(b+1)

	end

return ret

end

]]></config>
<event type="login" name="SaffariRegister" event="script"><![CDATA[

function onLogin(cid)

	registerCreatureEvent(cid, "SaffariDeath")
return true

end]]></event>
<talkaction words="/saffari;!saffari" event="buffer"><![CDATA[

domodlib('saffari_func')

	param = string.lower(param)
if getPlayerStorageValue(cid, config.storages[1]) <= 0 then

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"you are not in Saffari") return true

	end
if (param == "") then

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"invalid command, enter !saffari time or !safari leave") return true

elseif isInArray({"time","tempo"}, param) then

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (getPlayerStorageValue(cid, config.storages[2]) - os.time() > 0 and "Left "..timeString(getPlayerStorageValue(cid, config.storages[2]) - os.time()).."" or "Time is over. Please wait a moment.").."\nTo leave enter command: !saffari leave") return true

elseif isInArray({"sair","leave"},param) then

		doTeleportThing(cid, config.saffari_positions.exit)

		setPlayerStorageValue(cid, config.storages[1], 0)

		setPlayerStorageValue(cid, config.storages[2], 0)

		doPlayerSendTextMessage(cid,22,'you left the saffari zone.') return true

	end
]]></talkaction>
<globalevent name="SaffariCheck" interval="60" event="script"><![CDATA[

	domodlib('saffari_func')

	function onThink(interval, lastExecution)

		local on = getPlayersOnline()
if #on > 0 then
for i = 1, #on do
if getPlayerStorageValue(on[i], config.storages[1]) > 0 then
if getPlayerItemCount(on[i], config.saffari_balls[1]) <= 0 or getPlayerStorageValue(on[i], config.storages[2]) - os.time() <= 0 then

						doTeleportThing(on[i], config.saffari_positions.exit)

						setPlayerStorageValue(on[i], config.storages[1], 0)

						setPlayerStorageValue(on[i], config.storages[2], 0)

						doPlayerSendTextMessage(on[i],22,'you left the saffari zone.')

					end

				end

			end

		end
return true

	end
]]></globalevent>
<event type="death" name="SaffariDeath" event="script"><![CDATA[

	domodlib('saffari_func')

	function onDeath(cid, corpse, deathList)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storages[1]) >= 1 then

			setPlayerStorageValue(cid, config.storages[1], 0)

			setPlayerStorageValue(cid, config.storages[2], 0)

			doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

		end
return true

	end
]]></event>
</mod>


 

 


 

 


NPC

 


 

 


 

 


Saffari Man.xml



 


<?xml version="1.0"?>

<npc name="Saffari Man" script="data/npc/scripts/saffari.lua" walkinterval="50000" floorchange="0">

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

<look type="129" head="95" body="116" legs="121" feet="115" addons="3"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|. You want to {enter} in the {saffari} zone!" />

</parameters>

</npc>


 

 


saffari.lua



domodlib('saffari_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,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower()
if isInArray({"saffari","enter","entrar"}, msg) then

		npcHandler:say('you can stay in the Saffari zone by '..config.minutes..' minutes, the price is '..config.price..' gp(s), You want enter? {yes}', cid)

		talkState[talkUser] = 1

	elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
for i = 1, #config.blocked_pokeballs do
if getPlayerItemCount(cid, config.blocked_pokeballs[i]) >= 1 then

				npcHandler:say('Keep your '..getItemNameById(config.blocked_pokeballs[i])..'!', cid) return true

			end

		end
if config.need_premium and not isPremium(cid) then

			npcHandler:say('Sorry, you need to be premium!', cid) return true

		elseif getPlayerLevel(cid) < config.level then

			npcHandler:say('Sorry, you must be at least level '..config.level..' to enter the Saffari zone!', cid) return true

		elseif not doPlayerRemoveMoney(cid, config.price) then

			npcHandler:say('Sorry, you do not have enough money!', cid) return true

			end

			doPlayerAddItem(cid, config.saffari_balls[1], config.saffari_balls[2])

			selfSay("Thanks, you've been teleported to the Saffari zone and has "..config.minutes.." minutes, if you want to leave enter {!saffari leave}.", cid)

			doTeleportThing(cid, config.saffari_positions.enter)

			setPlayerStorageValue(cid, config.storages[1], 1)

			setPlayerStorageValue(cid, config.storages[2], os.time()+config.minutes*60)

		elseif msg == "no" and talkState[talkUser] >= 1 then

			selfSay("then ok.", cid)

			talkState[talkUser] = 0

			npcHandler:releaseFocus(cid)

		end
return true

	end

	npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

	npcHandler:addModule(FocusModule:new())

 

 

onde vai a ubicacion d player? donde vai tirar tp e vai tirar to leave?

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...