CA

Saiba Tudo Sobre Storage

Por caotic, 20 de fev. de 2012 em Tutoriais de Scripting

storage
o que e storage
como ultilizar storage
caotic
storage otserv
duvida storage
script
otserv
8
8.6k
caoticC
20 de fevereiro de 2012 às 11:06

Bem iniciante de otserv tem duvidas do que e storage e estou aqui para resolver essa duvida.

Mais afinal o que e STORAGE?

Bem storage e uma função que guarda algum Valor (Numero ou Letras).

A storage guardada fica na databse do seu otserv.

 

Como posso usa-las?

Para colocar uma storage no player basta usar essa função:

Numero: setPlayerStorageValue(cid, 86784, 1)

Letras: setPlayerStorageValue(cid, 86784, Letras)

 

Os paramentos da storage que nos utilizamos:

Cid == Player.

86784 == Que storage nos utilizamos para guardar.

1 e Letras(Exemplo 2) == O que esta na storage

.

Desta vez utilizamos a storage 86784 e guardamos o valor um 1 e no exemplo dois a palavra Letras.

 

E ai como faz para verificar?

Simples, usamos outra função que verifica a storage e da o valor que este guardado:

getPlayerStorageValue(cid, 86784)

Utilizamos dois paramentos para buscar a storage

cid == Player

86784 == Onde o valor guardado da storage que queria verificar.

Pronto agora que saiba usar storage pode utilizar em seus scripts.

Editado Fevereiro 20 por caotic

diegoSkateD
20 de fevereiro de 2012 às 15:37

pow mano da hora... mas me tira uma dúvida aqui. Eu fiz um script que muda de outfit e talz... só que quando a pessoa da logout volta pro outfits de antes =( como eu faço pra que ele verifique e mesmo quando der logout ele volte com o mesmo outfit?

 

Obrigado!

caoticC
20 de fevereiro de 2012 às 16:22

Usando STORAGE posta o script que agente faz rapidin XD.

diegoSkateD
21 de fevereiro de 2012 às 00:14
local speedbonus = 1.0

 

local premium = false

local outfit = {

[0] = {lookType = 1034, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0},

[1] = {lookType = 1035, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}

}

 

local poke = {'Poliwag', 'Poliwhirl', 'Seaking', 'Dewgong', 'Blastoise', 'Tentacruel', 'Lapras', 'Gyarados', 'Omastar', 'Kabutops', 'Vaporeon', 'Staryu', 'Starmie', 'Goldeen', 'Seadra', 'Golduck', 'Squirtle', 'Wartortle', 'Tentacool', 'Snorlax', 'Poliwrath',

"Mantine", "Totodile", "Croconow", "Feraligatr", "Marill", "Azumarill", "Quagsire", "Wooper", "Octillery", "Kingdra"}

 

function onStepIn(cid, item, pos, fromPosition)

 

local npos = {x=pos.x, y=pos.y, z=pos.z + 1}

if isPlayer(cid) and not isPremium(cid) and premium == true then

doTeleportThing(cid, fromPosition, false)

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

return true

end

 

if isPlayer(cid) then

doTeleportThing(cid, npos)

doPlayerSay(cid, "Swimming!", TALKTYPE_ORANGE_1)

getCreatureCondition(cid, CONDITION_OUTFIT)

doSetCreatureOutfit(cid, outfit[getPlayerSex(cid)], -1)

doChangeSpeed(cid, speedbonus*getCreatureSpeed(cid))

else

return true

end

end

 

É mais ou menos assim... o player desce 1 andar e vai para akeles tiles de swimming dae ele muda o outfit... até ae tudo bem...

 

Não botei storageID, se liga na volta!

 

local dive = {

["Poliwag"] = {lookType=278, speed = 320},

["Poliwhirl"] = {lookType=137, speed = 480},

["Seaking"] = {lookType=269, speed = 520},

["Dewgong"] = {lookType=183, speed = 700},

["Blastoise"] = {lookType=184, speed = 850},

["Tentacruel"] = {lookType=185, speed = 750},

["Lapras"] = {lookType=186, speed = 960},

["Gyarados"] = {lookType=187, speed = 1050},

["Omastar"] = {lookType=188, speed = 680},

["Kabutops"] = {lookType=189, speed = 840},

["Poliwrath"] = {lookType=190, speed = 680},

["Vaporeon"] = {lookType=191, speed = 800},

["Staryu"] = {lookType=266, speed = 385},

["Starmie"] = {lookType=267, speed = 685},

["Goldeen"] = {lookType=268, speed = 355},

["Seadra"] = {lookType=270, speed = 655},

["Golduck"] = {lookType=271, speed = 760},

["Squirtle"] = {lookType=273, speed = 365},

["Wartortle"] = {lookType=275, speed = 605},

["Tentacool"] = {lookType=277, speed = 340},

["Snorlax"] = {lookType=300, speed = 500},

["Mantine"] = {lookType=636, speed = 820},

["Totodile"] = {lookType=637, speed = 360},

["Croconow"] = {lookType=638, speed = 590},

["Feraligatr"] = {lookType=645, speed = 900},

["Marill"] = {lookType=639, speed = 340},

["Azumarill"] = {lookType=642, speed = 680},

["Quagsire"] = {lookType=643, speed = 740},

["Kingdra"] = {lookType=644, speed = 1020},

["Octillery"] = {lookType=641, speed = 600},

["Wooper"] = {lookType=640, speed = 315},

}

 

function onStepIn(cid, item, pos, fromPosition)

local spos = {x=pos.x, y=pos.y, z=pos.z - 1}

if doTeleportThing(cid, spos) then

doSetCreatureOutfit(cid, {lookType = dive[getPokemonName(getCreatureSummons(cid)[1])].lookType + 351}, -1)

doChangeSpeed(cid, dive[getSpeed] * 1)

end

return true

end

 

Só q esse script ta bugado, se tiver como vc ajudar... O bug é o seguinte... se o player subir no tile com qualquer outro pokemon que não seja esses, no distro fica passando umas parada nem rapidao ;(

 

te dou rep+ E queria saber se ainda vai rolar as aulas lá de otserv, queria fazer de script lua.

 

Valew!

Editado Fevereiro 21 por diegoSkate

ZmovirZ
21 de fevereiro de 2012 às 00:27

LOL Spoiler nao abre manda sem spoiler talvez eu possa ajudar

caoticC
21 de fevereiro de 2012 às 07:42

Bem vamos la voce precisa postar o seu surfcancel aki pois e nele que precisamos mudar porque se pos storage so nesse script buga entao posta que ue concert

ai o player ao logar tera o mesmo outfit manda o surfcancel.

Agora em relaçao ao bug do distro e porque o script nao verifica se tem pokemon e nem o nome para concertar subtituia por seu primeiro script que posto por esse:

 

local speedbonus = 1.0

 

local premium = false

local outfit = {

[0] = {lookType = 1034, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0},

[1] = {lookType = 1035, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}

}

 

local poke = {'Poliwag', 'Poliwhirl', 'Seaking', 'Dewgong', 'Blastoise', 'Tentacruel', 'Lapras', 'Gyarados', 'Omastar', 'Kabutops', 'Vaporeon', 'Staryu', 'Starmie', 'Goldeen', 'Seadra', 'Golduck', 'Squirtle', 'Wartortle', 'Tentacool', 'Snorlax', 'Poliwrath',

"Mantine", "Totodile", "Croconow", "Feraligatr", "Marill", "Azumarill", "Quagsire", "Wooper", "Octillery", "Kingdra"}

function onStepIn(cid, item, pos, fromPosition)

 

local npos = {x=pos.x, y=pos.y, z=pos.z + 1}

if isPlayer(cid) and not isPremium(cid) and premium == true then

doTeleportThing(cid, fromPosition, false)

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

return true

end

if #getCreatureSummons(cid) == 0 then

doPlayerSendCancel(cid, "You need a pokemon to surf.")

return true

end

if not isInArray(poke, getCreatureName(getCreatureSummons(cid)[1])) then

doPlayerSendCancel(cid, "This poemon not use surf.")

return true

end

if isPlayer(cid) then

doTeleportThing(cid, npos)

doPlayerSay(cid, "Swimming!", TALKTYPE_ORANGE_1)

getCreatureCondition(cid, CONDITION_OUTFIT)

doSetCreatureOutfit(cid, outfit[getPlayerSex(cid)], -1)

doChangeSpeed(cid, speedbonus*getCreatureSpeed(cid))

else

return true

end

end

 

 

Agora outro script por esse:

 

 

 

local divepoke = {'Poliwag', 'Poliwhirl', 'Seaking', 'Dewgong', 'Blastoise', 'Tentacruel', 'Lapras', 'Gyarados', 'Omastar', 'Kabutops', 'Vaporeon', 'Staryu', 'Starmie', 'Goldeen', 'Seadra', 'Golduck', 'Squirtle', 'Wartortle', 'Tentacool', 'Snorlax', 'Poliwrath',

"Mantine", "Totodile", "Croconow", "Feraligatr", "Marill", "Azumarill", "Quagsire", "Wooper", "Octillery", "Kingdra"}

 

local dive = {

["Poliwag"] = {lookType=278, speed = 320},

["Poliwhirl"] = {lookType=137, speed = 480},

["Seaking"] = {lookType=269, speed = 520},

["Dewgong"] = {lookType=183, speed = 700},

["Blastoise"] = {lookType=184, speed = 850},

["Tentacruel"] = {lookType=185, speed = 750},

["Lapras"] = {lookType=186, speed = 960},

["Gyarados"] = {lookType=187, speed = 1050},

["Omastar"] = {lookType=188, speed = 680},

["Kabutops"] = {lookType=189, speed = 840},

["Poliwrath"] = {lookType=190, speed = 680},

["Vaporeon"] = {lookType=191, speed = 800},

["Staryu"] = {lookType=266, speed = 385},

["Starmie"] = {lookType=267, speed = 685},

["Goldeen"] = {lookType=268, speed = 355},

["Seadra"] = {lookType=270, speed = 655},

["Golduck"] = {lookType=271, speed = 760},

["Squirtle"] = {lookType=273, speed = 365},

["Wartortle"] = {lookType=275, speed = 605},

["Tentacool"] = {lookType=277, speed = 340},

["Snorlax"] = {lookType=300, speed = 500},

["Mantine"] = {lookType=636, speed = 820},

["Totodile"] = {lookType=637, speed = 360},

["Croconow"] = {lookType=638, speed = 590},

["Feraligatr"] = {lookType=645, speed = 900},

["Marill"] = {lookType=639, speed = 340},

["Azumarill"] = {lookType=642, speed = 680},

["Quagsire"] = {lookType=643, speed = 740},

["Kingdra"] = {lookType=644, speed = 1020},

["Octillery"] = {lookType=641, speed = 600},

["Wooper"] = {lookType=640, speed = 315},

}

 

function onStepIn(cid, item, pos, fromPosition)

if #getCreatureSummons(cid) == 0 then

doPlayerSendCancel(cid, "You need a pokemon to dive.")

return true

end

if not isInArray(divepoke, getCreatureName(getCreatureSummons(cid)[1])) then

doPlayerSendCancel(cid, "This poemon not use dive.")

return true

end

local spos = {x=pos.x, y=pos.y, z=pos.z - 1}

if doTeleportThing(cid, spos) then

doSetCreatureOutfit(cid, {lookType = dive[getPokemonName(getCreatureSummons(cid)[1])].lookType + 351}, -1)

doChangeSpeed(cid, dive[getSpeed] * 1)

end

return true

end

Editado Fevereiro 21 por caotic

diegoSkateD
21 de fevereiro de 2012 às 14:47

aqui é o surf cancel caotic! obrigado pela ajuda!

 

function onStepIn(cid, item, position, fromPosition)

if getPlayerStorageValue(cid, 17000) >= 1 then

return true

end

if getPlayerStorageValue(cid, 63215) >= 1 then

doRemoveCondition(cid, CONDITION_OUTFIT)

setPlayerStorageValue(cid, 63215, 0)

 

local item = getPlayerSlotItem(cid, 8)

local pokemon = getItemAttribute(item.uid, "poke")

local x = pokes[pokemon]

 

if getItemAttribute(item.uid, "nick") then

doCreatureSay(cid, getItemAttribute(item.uid, "nick")..", Im tired of surfing!", 1)

else

doCreatureSay(cid, getItemAttribute(item.uid, "poke")..", Im tired of surfing!", 1)

end

 

doSummonMonster(cid, pokemon)

 

local pk = getCreatureSummons(cid)[1]

 

doChangeSpeed(pk, getCreatureSpeed(cid))

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, PlayerSpeed)

 

doTeleportThing(pk, fromPosition, false)

doTeleportThing(pk, getThingPos(cid), true)

doCreatureSetLookDir(pk, getCreatureLookDir(cid))

 

adjustStatus(pk, item.uid, true, false, true)

 

return true

end

end

caoticC
21 de fevereiro de 2012 às 19:28

No surf voce coloca isso:

 

local speedbonus = 1.0

 

local premium = false

local outfit = {

[0] = {lookType = 1034, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0},

[1] = {lookType = 1035, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}

}

 

local poke = {'Poliwag', 'Poliwhirl', 'Seaking', 'Dewgong', 'Blastoise', 'Tentacruel', 'Lapras', 'Gyarados', 'Omastar', 'Kabutops', 'Vaporeon', 'Staryu', 'Starmie', 'Goldeen', 'Seadra', 'Golduck', 'Squirtle', 'Wartortle', 'Tentacool', 'Snorlax', 'Poliwrath',

"Mantine", "Totodile", "Croconow", "Feraligatr", "Marill", "Azumarill", "Quagsire", "Wooper", "Octillery", "Kingdra"}

function onStepIn(cid, item, pos, fromPosition)

 

local npos = {x=pos.x, y=pos.y, z=pos.z + 1}

if isPlayer(cid) and not isPremium(cid) and premium == true then

doTeleportThing(cid, fromPosition, false)

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

return true

end

if #getCreatureSummons(cid) == 0 then

doPlayerSendCancel(cid, "You need a pokemon to surf.")

return true

end

if not isInArray(poke, getCreatureName(getCreatureSummons(cid)[1])) then

doPlayerSendCancel(cid, "This poemon not use surf.")

return true

end

if isPlayer(cid) then

doTeleportThing(cid, npos)

doPlayerSay(cid, "Swimming!", TALKTYPE_ORANGE_1)

getCreatureCondition(cid, CONDITION_OUTFIT)

doSetCreatureOutfit(cid, outfit[getPlayerSex(cid)], -1)

doChangeSpeed(cid, speedbonus*getCreatureSpeed(cid))

setPlayerStorageValue(cid, 80898, 1)

else

return true

end

end

 

No surf cancel coloca isso:

 

function onStepIn(cid, item, position, fromPosition)

if getPlayerStorageValue(cid, 17000) >= 1 then

return true

end

if getPlayerStorageValue(cid, 63215) >= 1 then

doRemoveCondition(cid, CONDITION_OUTFIT)

setPlayerStorageValue(cid, 63215, 0)

 

local item = getPlayerSlotItem(cid, 8)

local pokemon = getItemAttribute(item.uid, "poke")

local x = pokes[pokemon]

 

if getItemAttribute(item.uid, "nick") then

doCreatureSay(cid, getItemAttribute(item.uid, "nick")..", Im tired of surfing!", 1)

else

doCreatureSay(cid, getItemAttribute(item.uid, "poke")..", Im tired of surfing!", 1)

end

 

doSummonMonster(cid, pokemon)

 

local pk = getCreatureSummons(cid)[1]

 

doChangeSpeed(pk, getCreatureSpeed(cid))

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, PlayerSpeed)

 

doTeleportThing(pk, fromPosition, false)

doTeleportThing(pk, getThingPos(cid), true)

doCreatureSetLookDir(pk, getCreatureLookDir(cid))

 

adjustStatus(pk, item.uid, true, false, true)

setPlayerStorageValue(cid, 80898, -1)

 

return true

end

end

 

agora

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

coloque isso no principio do script na primeira linha cole isso

local outfit = {

[0] = {lookType = 1034, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0},

[1] = {lookType = 1035, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}

}

 

Va no seu login.lua na pasta creatureevents e coloca isso pode ser no MEIO

if getPlayerStorageValue(cid, 80898) == 1 then

doSetCreatureOutfit(cid, outfit[getPlayerSex(cid)], -1)

doChangeSpeed(cid, speedbonus*getCreatureSpeed(cid))

setPlayerStorageValue(cid, 80898, 1)

return false

end.