Pedido Modificar Script

steveonly
em Lixeira Pública

steveonly

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/01/12Posts: 5

Eu possuo um script de reset por livro so que ele não esta dando certo

ele so some o livro e volta pro lv 8 eu queria que alguem mi ajudaçe a modificar para que

ele resetasse voltesse para o lv 8 so que com metade do hp e mp e assim

iria acumular grato

 

 

 

 

 

function onUse(cid, item, frompos)

local pid = getPlayerGUID(cid)

local level = 400

if not getTilePzInfo(getCreaturePosition(cid)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'O item so pode usar em protection zones.')

return true

end

if getPlayerLevel(cid) >= level then

if getPlayerStorageValue(cid, 96667) == -1 then

setPlayerStorageValue(cid, 96667, 0)

end

setPlayerStorageValue(cid, 96667, getPlayerStorageValue(cid, 96667)+1)

doRemoveItem(item.uid)

doRemoveCreature(cid)

db.executeQuery("UPDATE players SET level = 8 WHERE id = " .. pid)

end

return true

dragonfight

Sometimes I can't believe it
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 12/09/10Posts: 249

Testa ai:

 

function onUse(cid, item, frompos)
local pid = getPlayerGUID(cid)
local level = 400
local manaxx = getCreatureMaxMana(cid)/2
local healthmaxx = getCreatureMaxHealth(cid)/2
local health = getCreatureHealth/2
local mana = getCreatureMana/2
if not getTilePzInfo(getCreaturePosition(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'O item so pode usar em protection zones.')
return true
end
if getPlayerLevel(cid) >= level then
if getPlayerStorageValue(cid, 96667) == -1 then
setPlayerStorageValue(cid, 96667, 0)
end
setPlayerStorageValue(cid, 96667, getPlayerStorageValue(cid, 96667)+1)
doRemoveItem(item.uid)
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET mana = mana WHERE id = " .. pid)
db.executeQuery("UPDATE players SET manamax = manamaxx WHERE id = " .. pid)
db.executeQuery("UPDATE players SET health = health WHERE id = " .. pid)
db.executeQuery("UPDATE players SET healthmax = healthmaxx WHERE id = " .. pid)
db.executeQuery("UPDATE players SET level = 8 WHERE id = " .. pid)
end
return true

 

Obs: Não testei

tumblr_mbtch9L7iC1r2wtdzo1_500.jpg

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino
function onUse(cid, item, frompos)
local pid = getPlayerGUID(cid)
local level = 400
local new_level = 8
local mana = (getCreatureMaxMana(cid)/2)
local hp = (getCreatureMaxHealth(cid)/2)
if not getTilePzInfo(getCreaturePosition(cid)) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'O item so pode usar em protection zones.')
elseif getPlayerLevel(cid) < level then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'você precisa de level '..level..' ou mais para resetar.')end
if getPlayerStorageValue(cid, 96667) == -1 then
setPlayerStorageValue(cid, 96667, 0)
end
setPlayerStorageValue(cid, 96667, getPlayerStorageValue(cid, 96667)+1)
doRemoveItem(item.uid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..new_level..",`manamax` = "..mana..",`healthmax` = "..hp..",`health` = "..hp..",`mana` = "..mana.." WHERE `id` = "..pid)
return true
end

bossisg.png

steveonly

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/01/12Posts: 5

vodkart o item sumiu mas nada aconteceu '-' vou testar o do

dragonfight

o do dragon n prestou o do vod deu esse erro

[02/03/2012 13:38:54] [Error - LuaScriptInterface::loadFile] data/actions/scripts/reset.lua:25: 'end' expected (to close 'function' at line 1) near '<eof>'

[02/03/2012 13:38:54] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/reset.lua)

[02/03/2012 13:38:54] data/actions/scripts/reset.lua:25: 'end' expected (to close 'function' at line 1) near '<eof>'

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

...

Algum erro?

porque eu testei aqui e funcionou...

bossisg.png

steveonly

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/01/12Posts: 5

vod o seu deu esse erro

bem a versao do meu e 8.6 tfs 0.3.6

 

[02/03/2012 13:38:54] [Error - LuaScriptInterface::loadFile] data/actions/scripts/reset.lua:25: 'end' expected (to close 'function' at line 1) near '<eof>'

[02/03/2012 13:38:54] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/reset.lua)

[02/03/2012 13:38:54] data/actions/scripts/reset.lua:25: 'end' expected (to close 'function' at line 1) near '<eof>'

 

 

sera que e pelo fato de eu estar usando assim

<action itemid="2217" event="script" value="reset.lua"/>