[8.54] Itens Para Players Premium (Testado Em Poketibia)

Lawliett
em Tutoriais de Scripting

Lawliett

Aprendiz de Scripter
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/08/12Posts: 7Char no Tibia: No have

Itens Para Players Premium (Testado em Poketibia)

 

separador%20blog.jpg

 

 

 

Bom Galera, Eu procurei pelo Xtibia e outro Sites, e nao achei nenhum tutorial sobre o caso,

E vi muita gente procurando como fazer, para que um item seja usado apenas para player premium!

separador%20blog.jpg

 

Então vamos lá..

Vou usar como Exemplo a "Bike" que é o item mais procurado para esse tipo de Action, (Lembrando que pode ser usado em outros itens também) É bem simples!!

 

• Se voce ja tiver o arquivo Bike.lua em Data>Actions>Scripts, Provavelmente vai estar assim

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

local sBike = 2547

 

local t = {

[2547] = {article='a', name='bike', text='Mount, bike!', dtext='Demount, bike!', s=5700, condition=bikeCondition},

}

 

function BikeSpeedOn(cid,nSpeed)

setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,nSpeed)

end

function BikeSpeedOff(cid)

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))

end

 

 

local v, r = getCreaturePosition(cid), t[item.itemid]

local s = r.s

local pos = {x = v.x, y = v.y, z = v.z}

if r then

if getPlayerStorageValue(cid, 25000) == 5 then

return

end

if getPlayerStorageValue(cid, 23000) == 5 then

return

end

 

 

if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then

doPlayerSendCancel(cid, "You can't use bike while ride/fly/surf.")

return true

end

if getPlayerStorageValue(cid, s) <= 0 then

doCreatureSay(cid, r.text, 19)

setPlayerStorageValue(cid, s, 1)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. r.article .. ' '.. r.name .. '.')

BikeSpeedOn(cid,800)

if getPlayerSex(cid) == 1 then

doSetCreatureOutfit(cid, {lookType = 1394, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

else

doSetCreatureOutfit(cid, {lookType = 1393, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

end

 

 

elseif getPlayerStorageValue(cid, s) == 1 then

doCreatureSay(cid, r.dtext, 19)

setPlayerStorageValue(cid, s, 0)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted ' .. r.article .. ' '.. r.name .. '.')

BikeSpeedOff(cid)

return doRemoveCondition(cid, CONDITION_OUTFIT)

else

return doPlayerSendCancel(cid, 'You can\'t do this.')

end

else

return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')

end

 

end

 

 

Embaixo de:

 

local t = {

[2547] = {article='a', name='bike', text='Mount, bike!', dtext='Demount, bike!', s=5700, condition=bikeCondition},

}

 

 

 

Adicione :

local premium = true

 

 

Depois procure por:

 

function BikeSpeedOn(cid,nSpeed)

setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,nSpeed)

end

function BikeSpeedOff(cid)

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))

end

 

 

E adicione embaixo:

 

if not isPremium(cid) then

doPlayerSendCancel(cid, "Messagem enviada para os players free")

return true

end

 

 

Ficando o com o Script todo assim:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

local sBike = 2547

 

local t = {

[2547] = {article='a', name='bike', text='Mount, bike!', dtext='Demount, bike!', s=5700, condition=bikeCondition},

}

 

local premium = true

 

function BikeSpeedOn(cid,nSpeed)

setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,nSpeed)

end

function BikeSpeedOff(cid)

doChangeSpeed(cid,-getCreatureSpeed(cid))

doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))

end

 

if not isPremium(cid) then

doPlayerSendCancel(cid, "Vc nao é premium, Vaza.")

return true

end

 

 

local v, r = getCreaturePosition(cid), t[item.itemid]

local s = r.s

local pos = {x = v.x, y = v.y, z = v.z}

if r then

if getPlayerStorageValue(cid, 25000) == 5 then

return

end

if getPlayerStorageValue(cid, 23000) == 5 then

return

end

 

 

if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then

doPlayerSendCancel(cid, "You can't use bike while ride/fly/surf.")

return true

end

if getPlayerStorageValue(cid, s) <= 0 then

doCreatureSay(cid, r.text, 19)

setPlayerStorageValue(cid, s, 1)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. r.article .. ' '.. r.name .. '.')

BikeSpeedOn(cid,800)

if getPlayerSex(cid) == 1 then

doSetCreatureOutfit(cid, {lookType = 1394, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

else

doSetCreatureOutfit(cid, {lookType = 1393, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

end

 

 

elseif getPlayerStorageValue(cid, s) == 1 then

doCreatureSay(cid, r.dtext, 19)

setPlayerStorageValue(cid, s, 0)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted ' .. r.article .. ' '.. r.name .. '.')

BikeSpeedOff(cid)

return doRemoveCondition(cid, CONDITION_OUTFIT)

else

return doPlayerSendCancel(cid, 'You can\'t do this.')

end

else

return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')

end

 

end

 

 

Se ajudei, REP++?

Meus Trabalhos:

 

Rep++? Só se quiserem ;D

cauekenai12

Sem Comentarios
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 31/07/12Posts: 8Char no Tibia: Demonyaco

Muito bom me ajudou mto pena que to sem rep hoje D:

Treina meus Pokemons ai? Obrigado!!

cauekenai12left.pngcauekenai12right.png

 

 

Vai me dar REP+ ?? Guarde-o para outro.

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

Stigal

don't ever stop...
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 28/11/10Posts: 3402Gênero: Masculino

Otimo Cara.... Perfeito!

 

Vou Utilisar No Meu Servidor, So Que Com a Moto e Carro..

 

 

Abraço

VI6MDIG.png

 

"O fracasso é a oportunidade de se começar de novo inteligentemente"

Minhas Redes Sociais: Youtube | Página & Grupo | Steam  | Discord Xtibia | Skype: @mrooger

 

OTpanel

Critical

A fumaça queimando, tá escutando?
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 05/11/07Posts: 544

Seu tutorial foi aprovado, estará sendo movido para a seção correta.

 

Atenciosamente, Critical.

"Educai as crianças para não precisar punir os homens."

Gabrieltxu

O Héroi
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/06/12Posts: 2180Gênero: MasculinoChar no Tibia: Supreme Player

Boa Manow REP++ se Vc Puder se pode me passar um System Fly VIP e tambem o Teleport!?

Canal do facebook de lives!! cola la galera me ajudar seguindo a pagina hehe ! ❤️

 

               https://www.facebook.com/Tuxao0

Gabrieltxu

O Héroi
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/06/12Posts: 2180Gênero: MasculinoChar no Tibia: Supreme Player

Sim Preciso Só desses Se Puder fazer REP++

Canal do facebook de lives!! cola la galera me ajudar seguindo a pagina hehe ! ❤️

 

               https://www.facebook.com/Tuxao0

neneboca

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/01/12Posts: 23Char no Tibia: FireBlack

Tem como uza este mesmo sistema no Fly ?

Lawliett

Aprendiz de Scripter
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/08/12Posts: 7Char no Tibia: No have

Para deixar o FLY somente para Premium:

Vá em Data>Actions>Scripts>Order

e Procure por : ----START FLYorRIDE ---------

Substitua:

 

--if not isPremium(cid) then

--doPlayerSendCancel(cid, "Only premium members are allowed to fly or ride.")

--return true

--end

 

Por:

 

if not isPremium(cid) then

doPlayerSendCancel(cid, "Only premium members are allowed to fly.")

return true

end

 

 

Para deixar o TELEPORT somente para Premium:

Vá em Data>Talkactions>Scripts>Tele

Procure por: premium = false

e Substitua por: premium = true

Meus Trabalhos:

 

Rep++? Só se quiserem ;D

neneboca

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/01/12Posts: 23Char no Tibia: FireBlack

Vlw

Para deixar o FLY somente para Premium:

Vá em Data>Actions>Scripts>Order

e Procure por : ----START FLYorRIDE ---------

Substitua:

 

--if not isPremium(cid) then

--doPlayerSendCancel(cid, "Only premium members are allowed to fly or ride.")

--return true

--end

 

Por:

 

if not isPremium(cid) then

doPlayerSendCancel(cid, "Only premium members are allowed to fly.")

return true

end

 

 

Para deixar o TELEPORT somente para Premium:

Vá em Data>Talkactions>Scripts>Tele

Procure por: premium = false

e Substitua por: premium = true

vlw meu rep para vc

Gabrieltxu

O Héroi
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/06/12Posts: 2180Gênero: MasculinoChar no Tibia: Supreme Player

Para deixar o FLY somente para Premium:

Vá em Data>Actions>Scripts>Order

e Procure por : ----START FLYorRIDE ---------

Substitua:

 

--if not isPremium(cid) then

--doPlayerSendCancel(cid, "Only premium members are allowed to fly or ride.")

--return true

--end

 

Por:

 

if not isPremium(cid) then

doPlayerSendCancel(cid, "Only premium members are allowed to fly.")

return true

end

 

 

Para deixar o TELEPORT somente para Premium:

Vá em Data>Talkactions>Scripts>Tele

Procure por: premium = false

e Substitua por: premium = true

 

Vlw REP++

Canal do facebook de lives!! cola la galera me ajudar seguindo a pagina hehe ! ❤️

 

               https://www.facebook.com/Tuxao0

pokemo Imperial

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/03/18Posts: 3Gênero: Masculino

eu queria saber como por o comando !bug e o anuncio para so os vip usar