Salve gaz, já vi esse tipo de script em alguns foruns , porem não tão funcional, então decidir refazer , e acabou funfando. então vou compartilhar com vocês
Primeiro vai em Npc crie um arquivo xml e cole isso dentro
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Diana" script="ball.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="1030" head="116" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Bem-vindo à minha loja de pintura |PLAYERNAME| Se quizer pintar sua ball fale {paint}!"/>
</parameters>
</npc>
Depois vai em npc/scripts e cria um arquivo .lua chamado ball.lua e cole isso dentro
--[[
::: Script refeita por marshmello :::
::: Não remova os creditos Plase :::
]]
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 playerHaveItems(cid, itemid)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items) <= 0 then
return false
end
end
return true
end
function doPlayerRemoveItems(cid, itemid, count)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items, count ~= nil and count or 1)
end
return nil
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if(msgcontains(msg, 'paint')) then
selfSay('Você quer pintar a sua ball?', cid)
return true
end
local pokesalive = {'11826', '11832', '11835', '11829', '554', '11452', '12596', '12599', '11826', '11829', '11835', '11832', '12575'}
if(msgcontains(msg, 'quero')) then
selfSay('Olá, você pode escolher: Pokeball, Greatball, Superball, Ultraball, Safariball.', cid)
return true
end
-- normalball
if((msgcontains(msg, 'Pokeball') or msgcontains(msg, 'Poke ball') or msgcontains(msg, 'pokeball') or msgcontains(msg, 'poke ball'))) then
if isInArray(pokesalive, getPlayerSlotItem(cid,8).itemid) then
if doPlayerRemoveMoney(cid,80000) == true then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Pokeball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11826)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
else
selfSay('mantenha seu poke dentro da pokebola',cid)
end
end
--- great
if((msgcontains(msg, 'Greatball') or msgcontains(msg, 'Great ball') or msgcontains(msg, 'greatball') or msgcontains(msg, 'great ball'))) then
if isInArray(pokesalive, getPlayerSlotItem(cid,8).itemid) then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Greatball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
if doPlayerRemoveMoney(cid,30000) == true then
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11832)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
else
selfSay('mantenha seu poke dentro da pokebola',cid)
end
end
--- superball
if((msgcontains(msg, 'Superball') or msgcontains(msg, 'Super ball') or msgcontains(msg, 'super ball') or msgcontains(msg, 'superball'))) then
if isInArray(pokesalive, getPlayerSlotItem(cid,8).itemid) then
if doPlayerRemoveMoney(cid,70000) == true then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Superball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11835)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
else
selfSay('mantenha seu poke dentro da pokebola',cid)
end
end
-- ultraball
if((msgcontains(msg, 'Ultra ball') or msgcontains(msg, 'Ultraball') or msgcontains(msg, 'ultra ball') or msgcontains(msg, 'ultraball'))) then
if isInArray(pokesalive, getPlayerSlotItem(cid,8).itemid) then
selfSay('Boa escolha, a partir de agora um, ele vai olhar como uma Ultraball! Há qualquer outra coisa que eu possa ajudá-lo?', cid)
if doPlayerRemoveMoney(cid,50000) == true then
doTransformItem(getPlayerSlotItem(cid, 8).uid, 11829)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
else
selfSay('mantenha seu poke dentro da pokebola',cid)
end
end
------- saffari ball
if ((msgcontains(msg, 'Saffari ball') or msgcontains(msg, 'Saffariball') or msgcontains(msg, 'saffari ball') or msgcontains(msg, 'saffariball'))) then
selfSay('Boa escolha, a partir de agora ele vai olhar como uma saffariball! , Há qualuqer outra coisa que eu possa ajudá-lo ?', cid)
if doPlayerRemoveMoney(cid, 60000) == true then
doTransformItem(getPlayerSlotItem(cid, 8).uid, 10975)
else
selfSay('Sorry '.. getCreatureName(cid) ..', mas você não tem dinheiro suficiente.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Obrigada a @DarkWore Por identar o codigo pois n lembrava o site
Gostou ? deixe seu Rep+