• 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!

Solved Add two fuction on haste spells?

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
Hello!

My problem...

Normal haste:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
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 isPlayer(cid) == TRUE then 
        if exhaustion.check(cid, 30030) then 
            return FALSE 
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end

and I need add this without delete other fuctions (because it serves to "paralyze like RL") how I can do it, combine two?
Code:
function onCastSpell(cid, var)
		if getPlayerStorageValue(cid, 11001) == 1 then
			doPlayerSendCancel(cid, "You cannot use spells under participating in event.")
			return false
		end
		return doCombat(cid, combat, var)
	end
 
try this under oncastspell

LUA:
function onCastSpell(cid, var) 
    if isPlayer(cid) == TRUE then 
        if exhaustion.check(cid, 30030) then 
            return FALSE 
		if getPlayerStorageValue(cid, 11001) == 1 then
			doPlayerSendCancel(cid, "You can not use spells while participating in events.")
			return false
		end
		return doCombat(cid, combat, var)
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end
 
try this
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
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 isPlayer(cid) == TRUE then
        if getPlayerStorageValue(cid, 11001) == 1 and if exhaustion.check(cid, 30030) then 
           doPlayerSendCancel(cid, "You cannot use spells under participating in event."  
            return FALSE 
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var)
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end
 
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
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 getPlayerStorageValue(cid, 11001) == 1 then
		doPlayerSendCancel(cid, "You cannot use spells under participating in event.")
		return false
	end

        if exhaustion.check(cid, 30030) then 
            return false 
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
        end 
end
 
LUA:
function onCastSpell(cid, var) 
    if isPlayer(cid) == TRUE then 
		if getPlayerStorageValue(cid, 11001) == 1 then
			doPlayerSendCancel(cid, "You cannot use spells while participating in events.")
			return false
		else
        if exhaustion.check(cid, 30030) then 
            return FALSE 
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
	    return doCombat(cid, combat, var)
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end
end

try that, took another shot at it
 
I need use this fuction to end of haste spell's
LUA:
function onCastSpell(cid, var) 
    if isPlayer(cid) == TRUE then 
        if exhaustion.check(cid, 30030) then 
            return FALSE 
        else 
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end

And this

LUA:
function onCastSpell(cid, var)
		if getPlayerStorageValue(cid, 11001) == 1 then
			doPlayerSendCancel(cid, "You cannot use spells under participating in event.")
			return false
		end
		return doCombat(cid, combat, var)
	end

I dont know how to use two fuction in same spell
 
Can you tell me what this spell should do? I combinated the spells from what you wanted to combinate and it worked on my test server. So what does this spell not do what you want it to do?
 
Last edited:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
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 isPlayer(cid) == TRUE then 
        if exhaustion.check(cid, 30030) then 
            return FALSE 
        elseif getPlayerStorageValue(cid, 11001) == 1 then
		doPlayerSendCancel(cid, "You cannot use spells under participating in event.")
		return false
	else
            return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
        end 
    else 
        return doRemoveCondition(cid, CONDITION_HASTE), doCombat(cid, combat, var) 
    end 
end
 
Which server do you use? And tell exactly what it should do. For example: What is the reason you use exhaustion check for 30030 if there is no exhaustion set in this script? The part where it checks for a player didn't add anything to the script, so I removed it, if it should have a functional reason, then tell what it is. For the rest, you should get a cancel message if you have storage 11001 with value 1 and else it should work, unless you get errors. If you get errors, post them too. And like I said, the script I posted worked on my test server, so I'm trying to figure out why it doesn't work on yours.
 
Last edited:
Back
Top