Okulary potrzebne?;o
Stary skrypt: 59 linijek
Kod :
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"Mana UUPP!!!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"GoGo Mana!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "Ta rune mozesz uzywac tylko na graczach.")
end
end
end
return 1
end
Nowy: 38 linijek + konfiguracja na górze skryptu
Kod :
local config = {
exhaustTime = 1,
exhaustStorageId = 15435
}
function onUse(cid, item, frompos, item2, topos)
local lvl, mlvl = getPlayerLevel(cid), getPlayerMagLevel(cid)
-- formula settings
local manaMin = (lvl * 3.0) + (mlvl * 3.0)
local manaMax = (lvl * 3.0) + (mlvl * 5.0)
-- the rest of the script, don't edit if you don't know what are you doing
local manaAdd = math.random(manaMin, manaMax)
if(os.time() <= getPlayerStorageValue(cid, config.exhaustStorageId)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
return 1
end
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos, 30)
doSendAnimatedText(getPlayerPosition(cid), manaAdd, TEXTCOLOR_PURPLE)
doPlayerAddMana(item2.uid, manaAdd)
setPlayerStorageValue(cid, config.exhaustStorageId, os.time() + config.exhaustTime)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You may use this rune only on players.")
end
if(item.type > 1) then
doChangeTypeItem(item.uid, item.type - 1)
else
doRemoveItem(item.uid, 1)
end
end
Zakładki