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

Mana Booster Potion

Lava Titan

Developer
Joined
Jul 25, 2009
Messages
1,571
Solutions
3
Reaction score
97
Location
Portugal
i'm requesting a script for a item that adds onuse 150k mana but it can only be used one time per account...

ITEM ID: 7440
TFS: 0.3.5
Script type: Action script
 
LUA:
if getPlayerStorageValue(cid, 40689) == -1 then
   setPlayerMaxMana(cid, getPlayerMaxMana(cid) + 150000)
   setPlayerStorageValue(cid, 40689, 1)
end

one time per player this is. One time per account would be a bit silly but can be made with database changes.
 
LUA:
if getPlayerStorageValue(cid, 40689) == -1 then
   setPlayerMaxMana(cid, getPlayerMaxMana(cid) + 150000)
   setPlayerStorageValue(cid, 40689, 1)
end

one time per player this is. One time per account would be a bit silly but can be made with database changes.
@Lava Titan
Add MAX mana or mana?
in actions.xml:
PHP:
<action itemid="7440" event="script" value="manaitem.lua"/>
max. mana version:
PHP:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 40689) == -1 then
		setPlayerStorageValue(cid, 40689, 1)
		setPlayerMaxMana(cid, getPlayerMaxMana(cid) + 150000)
		return true
	end
	return false
end
Mana version:
PHP:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 40689) == -1 then
		setPlayerStorageValue(cid, 40689, 1)
		doCreatureAddMana(cid, 150000)
		return true
	end
	return false
end
 
I already had a script but i wenna know how to make it be able to be used only one time there is my mana booster script:

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        setCreatureMaxMana(cid, (getCreatureMaxMana(cid) + 150000)) then
        doCreatureSay(cid, "You gained 150,000 Max Mana Points, now your health is ".. getCreatureMaxMana(cid) .."!" ,19)
        return doRemoveItem(item.uid)
end

This script works fine but some ppl keep using tons of boosters and i want they to be able only to use one booster =/
 
7440 is for health boost potion...u are wrong lava! :D


19:25 You see a Mana Booster Potion.
ItemID: [7443].
Position: [X: 1015] [Y: 1006] [Z: 7].

19:25 You see a Health Booster Potion.
ItemID: [7440].
Position: [X: 1015] [Y: 1007] [Z: 7].

and so?...:D
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if getPlayerLevel(cid) >= 1000 then 
        setCreatureMaxMana(cid, (getCreatureMaxMana(cid) + 150000)) then 
        doCreatureSay(cid, "You gained 150,000 Max Mana Points, now your health is ".. getCreatureMaxMana(cid) .."!" ,19) 
        doRemoveItem(item.uid) 
    else 
        doPlayerSendCancel(cid, "Your level is not high enough.") 
    end 
    return TRUE 
end
 
idk who were you calling noob to but i know a thing.

This is not chit chat thread. This is a thread to request help not to hear ppl like you talking about the persons.
 
LUA:
local cfg = 
{ 
	level = 1000,
	itemid = 7440,
	newMana = 150000
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == cfg.itemid) then
		if getPlayerLevel(cid) >= cfg.level then  
			setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+cfg.newMana))
			doSendAnimatedText(getCreaturePosition(cid), "MANA!",TEXTCOLOR_RED)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doCreatureSay(cid, "You have recieved ".. cfg.newMana .." extra mana points, now your mana is ".. getCreatureMaxMana(cid) .."!", TALKTYPE_ORANGE_1)  
			doRemoveItem(item.uid)  
		else  
			doPlayerSendCancel(cid, "Your level is not high enough.")  
		end
		return TRUE
	end
end
 
Last edited:
Im sortve curious why it says there Health after they gain mana but Ok. And also Lava this is not the first time, Those scripts people have pasted do work and its not working due to you messing something simple up.
 
LUA:
local cfg = 
{ 
	level = 1000,
	itemid = 7440,
	newMana = 150000
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == cfg.itemid) then
		if getPlayerLevel(cid) >= cfg.level then  
			setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+cfg.newMana))
			doSendAnimatedText(getCreaturePosition(cid), "MANA!",TEXTCOLOR_RED)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doCreatureSay(cid, "You have recieved ".. cfg.newMana .." extra mana points, now your health is ".. getCreatureMaxMana(cid) .."!", TALKTYPE_ORANGE_1)  
			doRemoveItem(item.uid)  
		else  
			doPlayerSendCancel(cid, "Your level is not high enough.")  
		end
		return TRUE
	end
end

it works fine JBD but the problem is that it can be used more than one time per player =/

i want it to be used only one time per player

cant be added something like maxitemusage or maxusages on the script?
 
LUA:
local cfg = 
{ 
        level = 1000,
        itemid = 7440,
        newMana = 150000,
        storage = 1000
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if (item.itemid == cfg.itemid) then
                if getPlayerLevel(cid) >= cfg.level and getPlayerStorageValue(cid, cfg.storage) == -1 then  
                        setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+cfg.newMana))
                        doSendAnimatedText(getCreaturePosition(cid), "MANA!",TEXTCOLOR_RED)
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
                        doCreatureSay(cid, "You have recieved ".. cfg.newMana .." extra mana points, now your health is ".. getCreatureMaxMana(cid) .."!", TALKTYPE_ORANGE_1)  
                        doRemoveItem(item.uid) 
                        setPlayerStorageValue(cid, cgf.storage, 1) 
                else  
                        doPlayerSendCancel(cid, "Your level is not high enough.")  
                end
                return TRUE
        end
end
 
@Up,

change:
LUA:
setPlayerStorageValue(cid, cgf.storage, 1)
TO:
LUA:
setPlayerStorageValue(cid, cfg.storage, 1)
 
You should use this one, so the messages will work properly.

LUA:
local cfg = 
{ 
    level = 1000,
    itemid = 7440,
    newMana = 150000
}
local storage = 14565
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (item.itemid == cfg.itemid) then
        if getPlayerLevel(cid) >= cfg.level then
	    if getPlayerStorageValue(cid, storage) == -1 then
		setCreatureMaxMana(cid, (getCreatureMaxMana(cid)+cfg.newMana))
		setPlayerStorageValue(cid, storage, 1)
		doSendAnimatedText(getCreaturePosition(cid), "MANA!",TEXTCOLOR_RED)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
		doCreatureSay(cid, "You have recieved ".. cfg.newMana .." extra mana points, now your mana is ".. getCreatureMaxMana(cid) .."!", TALKTYPE_ORANGE_1)  
		doRemoveItem(item.uid)
	    else
		doPlayerSendCancel(cid, "You have already used this before.")
	    end
        else
	    doPlayerSendCancel(cid, "Your level is not high enough.")  
        end
        return TRUE
    end
end
 
Last edited:
Back
Top