Ir para conteúdo
  • 0

[Resolvido] colocar exausted nesse food


Emooooo

Pergunta

 

 

 

 

colocar exausted de 10 minutos nesse item +rep

 

 

 

 

 

local config = {

    storage = 10000, --use empty storage
    exhaust = 1800 --Exhaust is in seconds 600 equals 10min
}
 


local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(doAddCondition(cid, condition)) then
        doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
        doRemoveItem(item.uid)
               else
    doPlayerSendCancel(cid, "You are full.")
    end

    return true
end

Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 1
local config = {
    storage = 10000, --use empty storage
    exhaust = 1800 --Exhaust is in seconds 600 equals 10min
}
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.check(cid,config.storage) then
		return doPlayerSendCancel(cid, "You are full.")
	end
	doRemoveItem(item.uid)
	doAddCondition(cid, condition)
    doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
	exhaustion.set(cid,config.storage,config.exhaust)
    return true
end

Tinha uma simbolo mal formatado perdido no código, recomendo sempre que for fazer script em lua formatar o arquivo para ANSII

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

  • 0

@Emooooo

Spoiler


local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

if getPlayerStorageValue(cid, 4841) <= os.time() then
doPlayerSendCancel(cid, "Voce precisa esperar 10 minutos para usar")
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(doAddCondition(cid, condition)) then
        doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
        doRemoveItem(item.uid)
        setPlayerStorageValue(cid, 4841, os.time + 600)
               else
    doPlayerSendCancel(cid, "You are full.")
    end

    return true
end

TESTE

Link para o comentário
Compartilhar em outros sites

  • 0
42 minutos atrás, Marshmello disse:

@Emooooo

  Mostrar conteúdo oculto


local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

if getPlayerStorageValue(cid, 4841) <= os.time() then
doPlayerSendCancel(cid, "Voce precisa esperar 10 minutos para usar")
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(doAddCondition(cid, condition)) then
        doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
        doRemoveItem(item.uid)
        setPlayerStorageValue(cid, 4841, os.time + 600)
               else
    doPlayerSendCancel(cid, "You are full.")
    end

    return true
end

TESTE

[4/9/2018 15:23:26] [Error - Test Interface] 
[4/9/2018 15:23:26] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 15:23:26] Description: 
[4/9/2018 15:23:26] (LuaInterface::luaGetCreatureStorage) Creature not found

[4/9/2018 15:23:26] [Error - Test Interface] 
[4/9/2018 15:23:26] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 15:23:26] Description: 
[4/9/2018 15:23:26] data/actions/scripts/other/FilledjalapeñoPeppers.lua:5: attempt to compare boolean with number
[4/9/2018 15:23:26] [Error - Event::checkScript] Cannot load script (data/actions/scripts/other/FilledjalapeñoPeppers.lua)

Link para o comentário
Compartilhar em outros sites

  • 0
17 minutos atrás, Naruse disse:

Teste:

 


-- ARQUIVO .LUA QUALQUER USADO PARA TESTAR SCRIPTS.


local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

if getPlayerStorageValue(cid, gbb) - os.time() > 0 then
		doPlayerSendTextMessage(cid, 27, "Você precisa esperar 10 minutos para usar.")
	return true
	end

? 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(doAddCondition(cid, condition)) then
        doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
            doPlayerSendTextMe?ssage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
        doRemoveItem(item.uid)
        setPlayerStorageValue(cid, 4841, os.time + 600)
               else
    doPlayerSendCancel(cid, "You are full.")
    end

    return true
end

 

[4/9/2018 18:49:53] [Error - Test Interface] 
[4/9/2018 18:49:53] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 18:49:53] Description: 
[4/9/2018 18:49:53] data/actions/scripts/other/FilledjalapeñoPeppers.lua:5: attempt to perform arithmetic on a boolean value
[4/9/2018 18:49:53] [Error - Event::checkScript] Cannot load script (data/actions/scripts/other/FilledjalapeñoPeppers.lua)

Link para o comentário
Compartilhar em outros sites

  • 0
local config = {
    storage = 10000, --use empty storage
    exhaust = 1800 --Exhaust is in seconds 600 equals 10min
}
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.check(cid,config.storage) then
		return doPlayerSendCancel(cid, "You are full.")
	end
	doRemoveItem(item.uid)
	doAddCondition(cid, condition)
    doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
	exhaustion.set(cid,config.storage,config.exhaust)
    return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 0
10 minutos atrás, Crypter disse:

local config = {
    storage = 10000, --use empty storage
    exhaust = 1800 --Exhaust is in seconds 600 equals 10min
}
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.check(cid,config.storage) then
		return doPlayerSendCancel(cid, "You are full.")
	end
	doRemoveItem(item.uid)
	doAddCondition(cid, condition)
    doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
	exhaustion.set(cid,config.storage,config.exhaust)
    return true
end

 

[4/9/2018 19:31:8] [Error - LuaInterface::loadFile] data/actions/scripts/other/FilledjalapeñoPeppers.lua:2: '}' expected (to close '{' at line 1) near 'ï'
[4/9/2018 19:31:8] [Error - Event::checkScript] Cannot load script (data/actions/scripts/other/FilledjalapeñoPeppers.lua)
[4/9/2018 19:31:8] data/actions/scripts/other/FilledjalapeñoPeppers.lua:2: '}' expected (to close '{' at line 1) near 'ï'

Link para o comentário
Compartilhar em outros sites

  • 0
9 minutos atrás, Naruse disse:

Tente

 

 

[4/9/2018 19:33:41] [Error - Test Interface] 
[4/9/2018 19:33:41] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 19:33:41] Description: 
[4/9/2018 19:33:41] (LuaInterface::luaGetPlayerFlagValue) Player not found

[4/9/2018 19:33:41] [Error - Test Interface] 
[4/9/2018 19:33:41] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 19:33:41] Description: 
[4/9/2018 19:33:41] (LuaInterface::luaGetCreatureStorage) Creature not found

[4/9/2018 19:33:41] [Error - Test Interface] 
[4/9/2018 19:33:41] data/actions/scripts/other/FilledjalapeñoPeppers.lua
[4/9/2018 19:33:41] Description: 
[4/9/2018 19:33:41] data/lib/034-exhaustion.lua:17: attempt to compare number with boolean
[4/9/2018 19:33:41] [Error - Event::checkScript] Cannot load script (data/actions/scripts/other/FilledjalapeñoPeppers.lua)

Link para o comentário
Compartilhar em outros sites

  • 0
11 minutos atrás, Crypter disse:

local config = {
    storage = 10000, --use empty storage
    exhaust = 1800 --Exhaust is in seconds 600 equals 10min
}
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionFormula(condition, 9.4, -24, 10.9, -24)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.check(cid,config.storage) then
		return doPlayerSendCancel(cid, "You are full.")
	end
	doRemoveItem(item.uid)
	doAddCondition(cid, condition)
    doCreatureSay(cid, "Munch.",TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "its speed was increased by 1 hour.")
	exhaustion.set(cid,config.storage,config.exhaust)
    return true
end

Tinha uma simbolo mal formatado perdido no código, recomendo sempre que for fazer script em lua formatar o arquivo para ANSII

pego! thx

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...