Ir para conteúdo

Featured Replies

Postado

Quando eu uso o item aparece esse erro no console: 

Citar

Attempt to call global 'doPlayerSetStorageValue' <a nil value>
stack traceback:
[C]: in function 'doPlayerSetStorageValue'

 

Eu uso este script

local a = {
itemid = 26194, -- ID DO ITEM QUE VAI DAR A MOUNT
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, a.storage) == -1 then
		if getPlayerItemCount(cid, a.itemid) >= 1 then
			doPlayerAddMount(cid, a.mountID)
			doPlayerRemoveItem(cid, a.itemid, 1)
			doCreatureSay(cid, 'You receive the permission to ride a sparkion', TALKTYPE_MONSTER_SAY, 2, 2)
			doPlayerSetStorageValue(cid, a.storage, 1)
		else
			doPlayerSendCancel(cid, "You must have the item in the backpack in order to purchase your mount.")
			doSendMagicEffect(getPlayerPosition(cid), 2)
		end
	else
		doPlayerSendCancel(cid, "Sorry, you already have this mount.")
		doSendMagicEffect(getPlayerPosition(cid), 2)
	end
return TRUE
end

Eu queria esse script adicionasse a storage impedindo de ele usar o item de montaria novamente.
TFS 1.2

Desde já agradeço <3

Resolvido por KotZletY

Ir para solução
  • Respostas 8
  • Visualizações 803
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local a = { mountID = 94, -- ID DA MOUNT storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO } function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(a.s

Postado
Em 10/02/2017 ás 13:44, FlavioHulk disse:

Quando eu uso o item aparece esse erro no console: 

 

Eu uso este script


local a = {
itemid = 26194, -- ID DO ITEM QUE VAI DAR A MOUNT
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, a.storage) == -1 then
		if getPlayerItemCount(cid, a.itemid) >= 1 then
			doPlayerAddMount(cid, a.mountID)
			doPlayerRemoveItem(cid, a.itemid, 1)
			doCreatureSay(cid, 'You receive the permission to ride a sparkion', TALKTYPE_MONSTER_SAY, 2, 2)
			doPlayerSetStorageValue(cid, a.storage, 1)
		else
			doPlayerSendCancel(cid, "You must have the item in the backpack in order to purchase your mount.")
			doSendMagicEffect(getPlayerPosition(cid), 2)
		end
	else
		doPlayerSendCancel(cid, "Sorry, you already have this mount.")
		doSendMagicEffect(getPlayerPosition(cid), 2)
	end
return TRUE
end

Eu queria esse script adicionasse a storage impedindo de ele usar o item de montaria novamente.
TFS 1.2

Desde já agradeço <3


local a = {
itemid = 26194, -- ID DO ITEM QUE VAI DAR A MOUNT
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, a.storage) == -1 then
        if getPlayerItemCount(cid, a.itemid) >= 1 then
            doPlayerAddMount(cid, a.mountID)
            doPlayerRemoveItem(cid, a.itemid, 1)
            doCreatureSay(cid, 'You receive the permission to ride a sparkion', TALKTYPE_MONSTER_SAY, 2, 2)

            setPlayerStorageValue(cid, a.storage, 1)
        else
            doPlayerSendCancel(cid, "You must have the item in the backpack in order to purchase your mount.")
            doSendMagicEffect(getPlayerPosition(cid), 2)
        end
    else
        doPlayerSendCancel(cid, "Sorry, you already have this mount.")
        doSendMagicEffect(getPlayerPosition(cid), 2)
    end
return TRUE
end

 

Postado
  • Solução
local a = {
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if player:getStorageValue(a.storage) == -1 then
		if player:getItemCount(a.itemid) >= 1 then
			player:addMount(a.mountID)
			Item(item.itemid):remove(1)
			player:say("You receive the permission to ride a sparkion", TALKTYPE_MONSTER_SAY) 
			player:setStorageValue(a.storage, 1)
		else
			player:sendCancelMessage("You must have the item in the backpack in order to purchase your mount.")
			player:getPosition():sendMagicEffect(2)
		end
	else
		player:sendCancelMessage("Sorry, you already have this mount.")
		player:getPosition():sendMagicEffect(2)
	end
return TRUE
end

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
  • Autor
Em 11/02/2017 ás 07:54, luangop disse:

Nunca trabalhei com TFS 1.2 mas tente mudar o "doPlayerSetStorageValue" para "setPlayerStorageValue"

Valeu pela força, @luangop! Mas o script tinha que ser atualizado mesmo... Mas valeu pela tentativa <3

19 horas atrás, Gustavo Ntos disse:

 


local a = {
itemid = 26194, -- ID DO ITEM QUE VAI DAR A MOUNT
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, a.storage) == -1 then
        if getPlayerItemCount(cid, a.itemid) >= 1 then
            doPlayerAddMount(cid, a.mountID)
            doPlayerRemoveItem(cid, a.itemid, 1)
            doCreatureSay(cid, 'You receive the permission to ride a sparkion', TALKTYPE_MONSTER_SAY, 2, 2)

            setPlayerStorageValue(cid, a.storage, 1)
        else
            doPlayerSendCancel(cid, "You must have the item in the backpack in order to purchase your mount.")
            doSendMagicEffect(getPlayerPosition(cid), 2)
        end
    else
        doPlayerSendCancel(cid, "Sorry, you already have this mount.")
        doSendMagicEffect(getPlayerPosition(cid), 2)
    end
return TRUE
end

 

 

Eu tinha tentado fazer isso, mas também dava erro :S, mas valeu pela força!!!!! @Gustavo Ntos

12 horas atrás, KotZletY disse:

local a = {
mountID = 94, -- ID DA MOUNT
storage = 64656, -- STORAGE, SÓ ALTERE SE NECESSARIO
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if player:getStorageValue(a.storage) == -1 then
		if player:getItemCount(a.itemid) >= 1 then
			player:addMount(a.mountID)
			Item(item.uid):remove(1)
			player:say("You receive the permission to ride a sparkion", TALKTYPE_MONSTER_SAY) 
			player:setStorageValue(a.storage, 1)
		else
			player:sendCancelMessage("You must have the item in the backpack in order to purchase your mount.")
			player:getPosition():sendMagicEffect(2)
		end
	else
		player:sendCancelMessage("Sorry, you already have this mount.")
		player:getPosition():sendMagicEffect(2)
	end
return TRUE
end

 

Pô mano, valeu muito! Realmente funcionou, só ficou faltando o item id no local a nas primeiras linhas, mas corrigi isso! @KotZletY, e já te pergunto se posso postar diretamente no tópico de script?!

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo