LA
poketibia

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

Por Lawliett, 18 de ago. de 2012 em Tutoriais de Scripting

tibia
script
otserv
13
4.8k
LawliettL
18 de agosto de 2012 às 15:30

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++?

Editado Agosto 18 por Lawliett

cauekenai12C
18 de agosto de 2012 às 15:36

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

StigalS
20 de agosto de 2012 às 03:27

Otimo Cara.... Perfeito!

 

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

 

 

Abraço

CriticalC
20 de agosto de 2012 às 17:27

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

 

Atenciosamente, Critical.

LawliettL
21 de agosto de 2012 às 17:27

.....

Editado Agosto 23 por Lawliett

GabrieltxuG
22 de agosto de 2012 às 14:32

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

LawliettL
23 de agosto de 2012 às 14:17

Só Fly e Teleport?

GabrieltxuG
23 de agosto de 2012 às 16:29

Sim Preciso Só desses Se Puder fazer REP++

nenebocaN
24 de agosto de 2012 às 00:48

Tem como uza este mesmo sistema no Fly ?

LawliettL
24 de agosto de 2012 às 12:07

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

nenebocaN
24 de agosto de 2012 às 12:52

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
GabrieltxuG
24 de agosto de 2012 às 13:15

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++

5 anos depois...
09 de março de 2018 às 16:13

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