function onThink(cid, interval)
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerVocation(pid) == 2 then
doSendMagicEffect(getThingPos(pid), [COLOR="Blue"][B]CONST_ME_MAGIC_BLUE[/B][/COLOR])
end
end
return true
end
function onThink(cid, interval)
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerVocation(pid) == 2 then
local playerMana = getPlayerMana(cid)
if playerMana > 0 then
doCreatureAddMana(cid, -10)
doSendMagicEffect(getThingPos(pid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "You dont have mana points to send a special effect.")
end
return true
end
function onThink(cid, interval)
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerVocation(pid) == 2 then
playerMana = getPlayerMana(pid)
if playerMana > 0 then
doPlayerAddMana(cid, -10)
doSendMagicEffect(getThingPos(pid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "You don't have mana points to send a special effect.")
end
else
return true
end
end
return true
end
local function sendAndAdd(cid)
doSendMagicEffect(getThingPos(cid), 12)
doPlayerAddMana(cid, -10)
end
function onThink(cid, interval, lastExecution, thinkInterval)
if getPlayerVocation(cid) == 2 then
if getPlayerMana(cid) >= 10 then
addEvent(sendAndAdd, 1000, cid)
else
doPlayerSendCancel(cid, "You need at least 10 of mana to send a magic effect.")
return true
end
else
return true
end
return true
end
function onThink(interval, lastExecution, thinkInterval)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerVocation(cid) == 2 and getPlayerMana(cid) >= 10 then
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doCreatureAddMana(cid, -10)
end
end
return true
end
dont work..PHP:function onThink(cid, interval) for _, pid in ipairs(getPlayersOnline()) do if getPlayerVocation(pid) == 2 then local playerMana = getPlayerMana(cid) if playerMana > 0 then doCreatureAddMana(cid, -10) doSendMagicEffect(getThingPos(pid), CONST_ME_MAGIC_BLUE) else doPlayerSendCancel(cid, "You dont have mana points to send a special effect.") end return true end
thanks but i dont need send cancelHere, to add -10 mana per second...
PHP:function onThink(cid, interval) for _, pid in ipairs(getPlayersOnline()) do if getPlayerVocation(pid) == 2 then playerMana = getPlayerMana(pid) if playerMana > 0 then doPlayerAddMana(cid, -10) doSendMagicEffect(getThingPos(pid), CONST_ME_MAGIC_BLUE) else doPlayerSendCancel(cid, "You don't have mana points to send a special effect.") end else return true end end return true end
Or this (better)
PHP:local function sendAndAdd(cid) doSendMagicEffect(getThingPos(cid), 12) doPlayerAddMana(cid, -10) end function onThink(cid, interval, lastExecution, thinkInterval) if getPlayerVocation(cid) == 2 then if getPlayerMana(cid) >= 10 then addEvent(sendAndAdd, 1000, cid) else doPlayerSendCancel(cid, "You need at least 10 of mana to send a magic effect.") return true end else return true end return true end
work ;D thanks, but shows an animated text and in the server log say: You lost 10 mana.Code:function onThink(interval, lastExecution, thinkInterval) for _, cid in ipairs(getPlayersOnline()) do if getPlayerVocation(cid) == 2 and getPlayerMana(cid) >= 10 then doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doCreatureAddMana(cid, -10) end end return true end
function onThink(interval, lastExecution, thinkInterval)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerVocation(cid) == 2 and getPlayerMana(cid) >= 10 then
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doCreatureAddMana(cid, -10,[B][COLOR="Red"] false[/COLOR][/B])
end
end
return true
end
Code:function onThink(interval, lastExecution, thinkInterval) for _, cid in ipairs(getPlayersOnline()) do if getPlayerVocation(cid) == 2 and getPlayerMana(cid) >= 10 then doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doCreatureAddMana(cid, -10,[B][COLOR="Red"] false[/COLOR][/B]) end end return true end