• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action My scroll of awesomeness (exp scroll)

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,321
Reaction score
18
Location
Sweden - Dalarna
HELLO!!

Here's my exp scroll, easy to configure :D
LUA:
function onUse(cid, item, frompos, item2, topos)

-- Item ID
local ExpScroll = 6119

-- Storage Value
local ExpStorage = 99997

-- How much experience will be given?
local ExpAmount = 12500000

-- How many times may a player use this scroll?
local ExpTimes = 2 

-- Magic effect when true
local TrueMagicEffect = CONST_ME_MAGIC_RED 

-- Magic effect when used "ExpTimes" times
local FalseMagicEffect = CONST_ME_POFF 

-- Level when not able to use
local LevelLimit = 200

	if item.itemid == ExpScroll then
		if getPlayerLevel(cid) <= LevelLimit then
			if getPlayerStorageValue(cid, ExpStorage) ~= (ExpTimes-1) then
				doPlayerAddExperience(cid, ExpAmount)
				doSendMagicEffect(frompos, TrueMagicEffect)
				doRemoveItem(item.uid, 1)
				setPlayerStorageValue(cid, ExpStorage, (getPlayerStorageValue(cid, ExpStorage)+1))
			else
				doPlayerSendCancel(cid, "Either your level is above " .. LevelLimit .. " or you have already used this scroll " .. ExpTimes .. " times!")
				doSendMagicEffect(frompos, FalseMagicEffect)
			end
		end
	end
	return TRUE
end

Hotfix by Sync:
LUA:
function onUse(cid, item, frompos, item2, topos)

local c = {
	ExpScroll = 6119, -- Item ID
	ExpStorage = 99997, -- Storage Value
	ExpAmount = 12500000, -- How much experience will be given?
	ExpTimes = 2, -- How many times may a player use this scroll?
	TrueMagicEffect = CONST_ME_MAGIC_RED, -- What magic effect should be made when it work?
	FalseMagicEffect = CONST_ME_POFF, -- What magic effect should be made when it doesn't work?
	LevelLimit = 200 -- Which level are you not allowed to use it?
	}

	if item.itemid == c.ExpScroll then
		if getPlayerLevel(cid) <= c.LevelLimit then
			if getPlayerStorageValue(cid, c.ExpStorage) ~= (c.ExpTimes-1) then
				doPlayerAddExperience(cid, c.ExpAmount)
				doSendMagicEffect(frompos, c.TrueMagicEffect)
				doRemoveItem(item.uid, 1)
				setPlayerStorageValue(cid, c.ExpStorage, (getPlayerStorageValue(cid, c.ExpStorage)+1))
			else
				doPlayerSendCancel(cid, "You have already used this scroll " .. c.ExpTimes .. " times!")
				doSendMagicEffect(frompos, c.FalseMagicEffect)
			end
		end
	end
	return TRUE
end

Me is pro!
 
Last edited:
I laughed at your name, good release, I suppose... :thumbup:
 
Last edited:
i hate seeing so many locals in a script ;/
good one mang

LUA:
function onUse(cid, item, frompos, item2, topos)
local c = {
ExpScroll = 6119, -- item ID
ExpStorage = 99997, -- Storage Value
ExpAmount = 12500000, -- How much experience will be given?
ExpTimes = 2, -- How many times may a player use this scroll?
TrueMagicEffect = CONST_ME_MAGIC_RED, -- Magic effect when true
FalseMagicEffect = CONST_ME_POFF, -- Magic effect when used "ExpTimes" times
LevelLimit = 200 -- Level when not able to use
}
	if item.itemid == c.ExpScroll then
		if getPlayerLevel(cid) <= c.LevelLimit then
			if getPlayerStorageValue(cid, c.ExpStorage) ~= (c.ExpTimes-1) then
				doPlayerAddExperience(cid, c.ExpAmount)
				doSendMagicEffect(frompos, c.TrueMagicEffect)
				doRemoveItem(item.uid, 1)
				setPlayerStorageValue(cid, c.ExpStorage, (getPlayerStorageValue(cid, c.ExpStorage)+1))
			else
				doPlayerSendCancel(cid, "Either your level is above " .. c.LevelLimit .. " or you have already used this scroll " .. c.ExpTimes .. " times!")
				doSendMagicEffect(frompos, c.FalseMagicEffect)
			end
		end
	end
	return TRUE
end
 
Back
Top