Ir para conteúdo

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


Lawliett

Posts Recomendados

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 por Lawliett
Link para o comentário
Compartilhar em outros sites

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

Link para o comentário
Compartilhar em outros sites

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
Link para o comentário
Compartilhar em outros sites

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

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
×
×
  • Criar Novo...