Ir para conteúdo

[Problema] Item Nao Remove Storage


tavax

Posts Recomendados

Boas pessoal... estou tentando fazer com que um item adicione uma storage X e remova uma Y

 

meu Scripit...

 

function onUse(cid, item, frompos)

Query = db.getResult("SELECT `value`, `player_id`, `key` FROM `player_storage` WHERE `player_storage`.`player_id` = ".. getPlayerGUID(cid) ..";")


if item.itemid == 2626 and getPlayerStorageValue(cid,13195) == -1 then
	doRemoveItem(item.uid,1)
		setPlayerStorageValue(cid,13195,1)
			doSendMagicEffect(frompos,13)
				doBroadcastMessage(" The ".. getPlayerName(cid) .." found a new key to Spret Room.")
					doRemoveCreature(cid)
						db.executeQuery("DELETE FROM `player_storage` WHERE `player_storage`.`player_id` = "..getPlayerGUID(cid).." AND `player_storage`.`key` = 13194 ;")

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already use it")



end
end

 

ERRO NO SERVER \/ quando o player faz lought --- > doRemoveCreature(cid)

 


[Error - Action Interface]
data/actions/scripts/shop/other/pawn.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #18

[Error - Action Interface]
data/actions/scripts/shop/other/pawn.lua:onUse
Description:
data/actions/scripts/shop/other/pawn.lua:12: attempt to concatenate a boolean value
stack traceback:
       data/actions/scripts/shop/other/pawn.lua:12: in function <data/actions/scripts/shop/other/pawn.lua:1>

 

 

Espero que alguem me possa ajudar..

Link para o comentário
Compartilhar em outros sites

Você complicou o negócio

function onUse(cid, item, frompos, item2, topos)

if item.itemid == 2626 and getPlayerStorageValue(cid, 13195) == -1 then
doRemoveItem(item.uid,1)
setPlayerStorageValue(cid, 13195, 1)
setPlayerStorageValue(cid, 13194, -1)
doSendMagicEffect(frompos, 13)
doBroadcastMessage("The ".. getPlayerName(cid) .." found a new key to Spret Room.", 22)
doRemoveCreature(cid)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already use it.")
end

end

vê se assim n funfa

Link para o comentário
Compartilhar em outros sites

function onUse(cid, item, frompos, item2, topos)

local s = 13194 -- sua storage que vai ser deletada
local pid = getPlayerGUID(cid)
local v = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = " .. pid .. " AND `key` = " .. s .. ";")
local name = getPlayerName(cid)

if getPlayerStorageValue(cid,13195) <= 0 then 
setPlayerStorageValue(cid,13195,1) 
doSendMagicEffect(frompos,13) 
doBroadcastMessage(" The ".. name .." found a new key to Spret Room.")
doRemoveItem(item.uid, 1)
doRemoveCreature(cid)
db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = " .. pid .. " AND `key` = " .. s .. ";")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already use it") 
end
return TRUE
end

 

flw

Editado por Vodkart
Link para o comentário
Compartilhar em outros sites

1º erro

Errado:
Query = db.getResult("SELECT `value`, `player_id`, `key` FROM `player_storage` WHERE `player_storage`.`player_id` = ".. getPlayerGUID(cid) ..";")
Certo:
Query = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = " .. getPlayerGUID(cid) .. " AND `key` = " .. 13194 .. ";")

Errado:
db.executeQuery("DELETE FROM `player_storage` WHERE `player_storage`.`player_id` = "..getPlayerGUID(cid).." AND `player_storage`.`key` = 13194 ;")
Correto:
db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = " .. getPlayerGUID(cid) .. " AND `key` = 13194;")

 

Isso realmente deleta da database, mas na minha idéia eu só mudei o storage pra -1, pois qualquer storage de qualquer player sem alteração é -1

Editado por Eskylo
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...