Ir para conteúdo
  • 0

problema com doPlayerAddMana


craigmabbit

Pergunta

estou usando return false em spell pra poder usa doAnimatedText, ai resolvi usar doPlayerAddMana pra remover a mana do player, mas a função não executa

o script está assim

 

local temp = {

exhausted = 2,
storage = 100
}
local confg = {
mp = 10
}
function onCastSpell(cid, var)
if(getPlayerStorageValue(cid, temp.storage) > os.time() and getPlayerStorageValue(cid, temp.storage) < 100+os.time()) then
doPlayerSendTextMessage(cid, 24, "you are exhausted, wait " .. getPlayerStorageValue(cid, temp.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, temp.storage) - os.time()) == 1 and "" or "s"))
return false
end
if getPlayerMana(cid) >= confg.mp then
local min = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.4)
local max = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.5)
local target = getCreatureTarget(cid)
if getCreatureOutfit(cid).lookType == 128 then
actionMove(cid, 352, 800)
end
FireEffect(cid)
noMove(cid, 800)
doPlayerAddMana(cid, -confg.mp)
addEvent(doSendAnimatedText, 200, getThingPos(cid), "Fire:", COLOR_RED)
addEvent(doSendAnimatedText, 600, getThingPos(cid), "BLAST !", COLOR_RED)
addEvent(doTargetCombatHealth, 900, cid, target, COMBAT_FIREDAMAGE, -min, -max, 6)
addEvent(doSendDistanceShoot, 900, getCreaturePosition(cid), getThingPos(target), 3)
setPlayerStorageValue(cid, temp.storage, os.time() + temp.exhausted)
else
doPlayerSendCancel(cid, "you do not have mana.")
end
end
Editado por craigmabbit
Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

O certo é sem o local function.. assim

 
local temp = {
exhausted = 2,
storage = 100
}
 
local confg = {
mp = 10
}

function removemana(cid)
doPlayerAddMana(cid, -10)
end
 
function onCastSpell(cid, var)
if(getPlayerStorageValue(cid, temp.storage) > os.time() and getPlayerStorageValue(cid, temp.storage) < 100+os.time()) then
doPlayerSendTextMessage(cid, 24, "you are exhausted, wait " .. getPlayerStorageValue(cid, temp.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, temp.storage) - os.time()) == 1 and "" or "s"))
return false
end
if getPlayerMana(cid) >= confg.mp then
local min = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.4)
local max = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.5)
local target = getCreatureTarget(cid)
if getCreatureOutfit(cid).lookType == 128 then
actionMove(cid, 352, 800)
end
FireEffect(cid)
noMove(cid, 800)
removemana(cid)
addEvent(doSendAnimatedText, 200, getThingPos(cid), "Fire:", COLOR_RED)
addEvent(doSendAnimatedText,  600, getThingPos(cid), "BLAST !", COLOR_RED)
addEvent(doTargetCombatHealth, 900, cid, target, COMBAT_FIREDAMAGE, -min, -max, 6)
addEvent(doSendDistanceShoot, 900, getCreaturePosition(cid), getThingPos(target), 3)
setPlayerStorageValue(cid, temp.storage, os.time() + temp.exhausted)
else
doPlayerSendCancel(cid, "you do not have mana.")
end
end
 
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta com esse:

local temp = {
	exhausted = 2,
	storage = 100
}
 
local confg = {
	mp = 10
}

function removemana(cid)
	doCreatureAddMana(cid, -10)
end
 
function onCastSpell(cid, var)
	if(getPlayerStorageValue(cid, temp.storage) > os.time() and getPlayerStorageValue(cid, temp.storage) < 100+os.time()) then
		doPlayerSendTextMessage(cid, 24, "you are exhausted, wait " .. getPlayerStorageValue(cid, temp.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, temp.storage) - os.time()) == 1 and "" or "s"))
		return false
	end
		if getPlayerMana(cid) >= confg.mp then
			local min = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.4)
			local max = (getPlayerLevel(cid) + getPlayerSkill(cid, SKILL_MAGLEVEL)*0.5)
			local target = getCreatureTarget(cid)
			if getCreatureOutfit(cid).lookType == 128 then
				actionMove(cid, 352, 800)
			end
		FireEffect(cid)
		noMove(cid, 800)
		removemana(cid)
		addEvent(doSendAnimatedText, 200, getThingPos(cid), "Fire:", COLOR_RED)
		addEvent(doSendAnimatedText,  600, getThingPos(cid), "BLAST !", COLOR_RED)
		addEvent(doTargetCombatHealth, 900, cid, target, COMBAT_FIREDAMAGE, -min, -max, 6)
		addEvent(doSendDistanceShoot, 900, getCreaturePosition(cid), getThingPos(target), 3)
		setPlayerStorageValue(cid, temp.storage, os.time() + temp.exhausted)
	else
		doPlayerSendCancel(cid, "you do not have mana.")
	end
end
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...