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

Lua Help! [XML] Tibia 8.1 vocation manarune both scripts

Status
Not open for further replies.

Angelika1993

New Member
Joined
Oct 6, 2014
Messages
46
Reaction score
2
Hello i have two scripts, and both working but i need this both in one. I try but not works..
I need vocation manarune :
Here is mine :

PHP:
[LIST=1]
[*]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 = 1000 -- 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 * 7) + (mlevel * 8)
[*]local mana_maximum = (level * 7) + (mlevel * 8)
[*]-- 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, CONST_ME_LOSEENERGY)
[*]

[*]doPlayerAddMana(item2.uid, mana_add)
[*]setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
[*]doChangeTypeItem(item.uid, item.type - 1)
[*]else
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "This rune you can only use 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, CONST_ME_LOSEENERGY)
[*]

[*]doPlayerAddMana(item2.uid, mana_add)
[*]setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
[*]

[*]else
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "This rune you can only use on players.")
[*]end
[*]end
[*]end
[*]

[*]return 1
[*]end
[/LIST]
Here is second with vocation.... :
PHP:
[LIST=1]
[*]function onUse(cid, item, frompos, item2, topos)
[*]

[*]local playerpos = getPlayerPosition(cid)
[*]local vocation = getPlayerVocation(cid)
[*]local manaadd = math.random(100,250)
[*]

[*]

[*]if (vocation == 4) or (vocation == 8) then
[*]doPlayerAddMana(cid, manaadd)
[*]doPlayerSay(cid,"Mniam...",1)
[*]doRemoveItem(item.uid, 1)
[*]doSendMagicEffect(playerpos, 12)
[*]else
[*]doPlayerSendTextMessage(cid,19,"You are not knight or elite knight.")
[*]end
[*]end
[/LIST]
Can you help me?
 
Sprawdź ten i zobacz czy wszystko ok.
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(v == 1 or v == 2 or v == 5 or v == 6) then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(cid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
 
Sprawdź ten i zobacz czy wszystko ok.
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(v == 1 or v == 2 or v == 5 or v == 6) then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(cid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
To samo, you can not use, brak tego napisu o używaniu runy i exhause. Ciężka sprawa z tym jesst :p
 
Status
Not open for further replies.

Similar threads

Back
Top