MA
erro

erro no script

Por macalo, 24 de jan. de 2016 em Scripts

atak
resolvido
script
4
1.6k
macaloM
24 de janeiro de 2016 às 12:20


[Error - CreatureScript Interface]

data/creaturescripts/scripts/staminafiller.lua:onAttack

Description:

data/creaturescripts/scripts/staminafiller.lua:7: attempt to perform arithmetic on a string value

stack traceback:

data/creaturescripts/scripts/staminafiller.lua:7: in function <data/creaturescripts/scripts/staminafiller.lua:1>

 


function onAttack(cid, target)

 

 

 

local storage = 193879834

local tempo = 1*60 ----(1 minuto)

local minutes = 5

if isMonster(target) and getCreatureName(target):lower() == 'training monk' then

doPlayerSetStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+1)

if getPlayerStorageValue(cid, storage) >= tempo then

doPlayerAddStamina(cid, minutes)

doPlayerSetStorageValue(cid, storage, 0)

end

end

return true

end

 

 

 

DanihcvD
25 de janeiro de 2016 às 02:41
Melhor resposta

Tenta assim:

local storage = 193879834
local tempo = 1*60 ----(1 minuto)
local minutes = 5

function onAttack(cid, target) 
	if isMonster(target) and getCreatureName(target):lower() == 'training monk' then
	strValue = getPlayerStorageValue(cid, storage)
	doPlayerSetStorageValue(cid, storage, strValue+1)
		if getPlayerStorageValue(cid, storage) >= tempo then
		doPlayerAddStamina(cid, minutes)
		doPlayerSetStorageValue(cid, storage, 0)
		end
	end
return true
end

Caso não dê certo, tente assim:

local storage = 193879834
local tempo = 1*60 ----(1 minuto)
local minutes = 5

function onAttack(cid, target) 
	if isMonster(target) and string.lower(getCreatureName(target)) == "training monk" then
	strValue = getPlayerStorageValue(cid, storage)
	doPlayerSetStorageValue(cid, storage, strValue+1)
		if getPlayerStorageValue(cid, storage) >= tempo then
		doPlayerAddStamina(cid, minutes)
		doPlayerSetStorageValue(cid, storage, 0)
		end
	end
return true
end

Editado Janeiro 25 por Danihcv

macaloM
25 de janeiro de 2016 às 03:01

vlw deu certo!!!!!

DanihcvD
25 de janeiro de 2016 às 03:02

Tópico movido para dúvidas / pedidos resolvidos.