• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

vocation x = effect x/seccond

JorgeXxD

New Member
Joined
Jun 16, 2010
Messages
25
Reaction score
0
hello i need script when any1 are vocation id 2 send magic effect per second

can help plz :)?
 
Global event, NOT the best way.
Code:
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
 
omfg it work, thankz very much :) i rep you :D

other request:
can u add to the script lost 10 mana per second?

PD: sorry for my bad english
 
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
 
Here, 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
 
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
 
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
dont work..

Here, 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
thanks but i dont need send cancel


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
work ;D thanks, but shows an animated text and in the server log say: You lost 10 mana.

any idea to avoid this :)?

thanks to all
 
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
 
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

thanks it work, i rep you :wub:
 
Back
Top