• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

spell in range

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
132
Location
Unknown
I'm looking for a Spell in range example

if you are in range -> frompos = {x=32499, y=32403, z=7} topos = {x=32512,y=32411,z=7} you can't use the spell example "You can't use this spell in a event"..



Please here is the script..
Need fast help...

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
LUA:
 local from = {x=32499, y=32403, z=7}
local to = {x=32512,y=32411,z=7}



local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)
 
function onCastSpell(cid, var)
if isInRange(getThingPos(cid), from, to) then
	doPlayerSendCancel(cid, "You can't use this spell in a event")
	else
	return doCombat(cid, combat, var)
end

try it, let me know if it works.
 
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
    local from, to = {x=32499, y=32403, z=7}, {x=32512,y=32411,z=7}
    if not(isInRange(getCreaturePosition(cid), from, to)) then
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid, "You cannot use this spell in this area.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
    end
end

Should be working. :p
 
example:
LUA:
fromfirst = {x=32499, y=32403, z=7} tofirst = {x=32512,y=32411,z=7}
fromsecond = {x=32499, y=32403, z=7} tosecond = {x=32512,y=32411,z=7}
    if not(isInRange(getCreaturePosition(cid), fromfirst, tofirst)) then
    if not(isInRange(getCreaturePosition(cid), fromsecond, tosecond)) then
I'm talking about two floors in range
 
LUA:
local from, fromsecond = {x=32499, y=32403, z=7}, {x=32499, y=32403, z=7}

local to, tosecond = {x=32512,y=32411,z=7}, {x=32499, y=32403, z=7}
 
 
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)
 
function onCastSpell(cid, var)
if isInRange(getThingPos(cid), from, to) or isInRange(getThingPos(cid), fromsecond, tosecond) then
	doPlayerSendCancel(cid, "You can't use this spell in a event")
	else
	return doCombat(cid, combat, var)
end
 
LUA:
local from, fromsecond = {x=32499, y=32403, z=7}, {x=32499, y=32403, z=7}

local to, tosecond = {x=32512,y=32411,z=7}, {x=32499, y=32403, z=7}
 
 
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)
 
function onCastSpell(cid, var)
if isInRange(getThingPos(cid), from, to) or isInRange(getThingPos(cid), fromsecond, tosecond) then
	doPlayerSendCancel(cid, "You can't use this spell in a event")
	else
	return doCombat(cid, combat, var)
end

Nop, actually just change from.z to 6 or any floor and to.z to other floor I.E.
LUA:
local from, to = {x=100, y=100, z=5}, {x=100, y=100, z=7}
 
Back
Top