Zuaro
New Member
I want to make a invisible rune but it's not really good working...
Problems:
-Runes is infinite useable
-Magic level 20 is need and I want level 15 and no ML.
-It only haves to make you invisble for 5 minutes
Can Someone help me?
Problems:
-Runes is infinite useable
-Magic level 20 is need and I want level 15 and no ML.
-It only haves to make you invisble for 5 minutes
Code:
function onUse(cid, item, frompos, item2, topos)
--Config
local reqml = 0 --Magic Level required to use it
local reqlvl = 15 --Character Level required to use it
local potExhaust = true -- causes exhaust like potions (false creates seperate exhaust for mana rune)
local ani = 12 --Animation to be sent to player when used (these can be found in your global.lua; search for CONST_ME_)
local exhaustTime = 5 --Exhaust in seconds
local infinite = false --Will it cause rune to lose charges
local canUseInPz = true --If true, invisible rune may be used in PZ, otherwise, it will not work.
local player_say = "Poof!" --What player says after successfully using the mana rune
local error_ml = "You don't have the required magic level to use that rune." --What the cancel says when ml is too low
local error_lvl = "You don't have the required level to use this rune." --What the cancel says when level is too low
local error_notPlayer = "You can only use this rune on players." --What the cancel says when you try to use it on something not a player
local error_exhaust = "You are exhausted." --What the cancel says when you are exhausted
------------------------------------------- DO NOT EDIT BELOW THIS LINE!! -------------------------------------------
---------------------------START Check for Errors--------------------------------
--If not high enough level, send poof and cancel message
if getPlayerLevel(cid) < reqlvl then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, error_lvl)
return 0
end
--If ml is too low, send poof and cancel message
if getPlayerMagLevel(cid) < reqml then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, error_ml)
return 0
end
--Check if exhausted
if potExhaust == false then --If not using Potion Exhaust
if exhaust(cid, storeValue, exhaustTime) == 0 then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, error_exhaust)
return 0
end
else --If you are using potion exhaust
if hasCondition(cid, CONDITION_EXHAUSTED) == 1 then
doPlayerSendCancel(cid, error_exhaust)
return 0
end
end
---------------------------END Check for Errors--------------------------------
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
--Exhaust System created by Alreth
--Edited by OsoSangre
function exhaust(cid, storeValue, exhaustTime)
local newExhaust = os.time()
local oldExhaust = getPlayerStorageValue(cid, storeValue)
if (oldExhaust == nil or oldExhaust < 0) then
oldExhaust = 0
end
if (exhaustTime == nil or exhaustTime < 0) then
exhaustTime = 1
end
diffTime = os.difftime(newExhaust, oldExhaust)
if (diffTime >= exhaustTime) then
setPlayerStorageValue(cid, storeValue, newExhaust)
return 1
else
return 0
end
end
Can Someone help me?