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

Action Universal Experience Scroll

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,015
Solutions
3
Reaction score
629
Location
Canada
Alright everyone, gather 'round the fire now. It's time to sing a song!
Actually, we'll save the song for later. I've just created a universal experience scroll that operates in two ways. If you're a VIP, it gives you 10,000,000 experience, stopping you at level 200. However, if you're not a VIP and you use it, it'll only give you 2,500,000 experience and it'll stop you at level 150. I've tested it fully on TFS Crying Damson 0.3.6 pl1.

First, in actions.xml put this somewhere.
Code:
<action itemid="7492" event="script" value="other/exp.lua"/> <!-- Exp Item -->

After you have this, go to your scripts and go to other. Make a file called exp.lua and paste the following.
Code:
--RazorBlade's custom experience scroll script. All credits go to RazorBlade. Comment and/or add reputation if you like it. This is fully tested.--

function onUse(cid, item, fromPosition, itemEx, toPosition) --Function We're Using.--
	if getPlayerLevel(cid) < 201 then --Checks if the character is level 200 or lower.--
	if getPlayerStorageValue(cid,50000) == 1 then --This is the storage and value I use for VIP. If yours is different, change it here.--
		doPlayerAddExperience(cid, 10000000) --This is the amount of experience you'll gain as a VIP.--
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You gained 10,000,000 experience!") --Sends the player a message saying they've gained 10 million experience.--
		doRemoveItem(item.uid, 1) --Removes the experience scroll or item that you use. Doesn't have to be a scroll. Since it's removing the item.uid, rather than removing it from the player, you don't have to be holding the item.--
	elseif getPlayerLevel(cid) < 151 then --If they don't qualify under the circumstances above, it'll move onto this one instead and checks if they're level 150 or lower.--
		doPlayerAddExperience(cid, 2500000) --This is the amount of experience you'll gain as a Non-VIP. Notice we aren't checking for a storage value this time. We don't need to if they aren't a VIP. We already checked for VIP above.--
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You gained 2,500,000 experience!") --Sends the player a message saying they've received 2.5 million experience.--
		doRemoveItem(item.uid, 1) --Again, removes the experience scroll or item you have chosen.--
	else --If it doesn't qualify under either, it moves to the line below.--
		doPlayerSendCancel(cid, "Sorry, you can't be higher than level 150 unless you're a VIP.") --Sends a cancel message telling them that they can't use this higher than level 150 unless they are a VIP.--
	end --Needed after an else. Will end the last if or function used.--
	else --If it doesn't qualify under either, but IS a VIP, it'll recognize that you're a VIP and that you're over level 200 and move to the next line.--
		doPlayerSendCancel(cid, "Sorry, you can't be higher than level 200.") --Sends a cancel message telling them they can't use this higher than level 200.--
	end --Needed after else, and will end our second if.
end --Ends the function

--Notice that the cancel message for Non-VIP comes before the one for VIP, even though the function checks VIP before checking Non-VIP.--
--The else works for the last used if or elseif, and the last else will be for the first if. This is important to remember when creating scripts with more than one if.--

If you should encounter any problems, leave a comment and tell me. I only tested this on 0.3.6pl1 so if you have issues on an earlier version, I don't have an earlier version to adapt it. There shouldn't be any issues though, since the functions I used are quite basic. If you like it, comment and rep me :)

Have fun! ;D :ninja:
 
Last edited:

Why, thank you. Though, it's disappointing the length of time this thread has been up and the number of replies is 1. D: Personally, I'm very proud of this script, as I am but a junior scripter.
 
hello
nice idea but I made another script with more easy configuration
feel free to use, edit and distribute with your modifications, but don't forget credits
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local storagevip = 50000
local multvipexp = 2

local config = {
  {level = 201, exp = 15000000},
}

for value = 1,#config do
     if getPlayerLevel(cid) < config[value].level then
         if getPlayerStorageValue(cid, storagevip) == 1 then
             doPlayerAddExperience(cid, config.exp * multvipexp)
             doRemoveItem(item.uid, 1)
             doSendMagicEffect(fromPosition, 26)
		 else
             doPlayerAddExperience(cid, config.exp)
             doRemoveItem(item.uid, 1)
             doSendMagicEffect(fromPosition, 27)
         end
     end
end
end

config is the config
level is the minimum lvl, exp is the exp that will be added
storagevip is the storage of vip players
multvipexp is a number that will increase in * the normal exp (in this case, vip will receive 2 more exp)
if it gives an error at the bottom, just exclude some ends (i cant test the script now, but must works)
 
the code is messy as hell, why would you make this when there's thousands of these already released?
 
Code:
if getPlayerLevel(cid) < 201 then --Checks if the character is level 200 or lower.--

Is only under 201 oo
 
To me, it doesn't really matter if it's messy... When I look at this script, it's easy to configure for me, and I can read it just fine so whatever. D:
 
When I saw "universal" as the title name, I thought of the whole server. Perhaps this can be used for a mistake that a gamemaster made. I haven't tested this, but it might work. If not, it's a start to something new. :thumbup:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {}
	cfg.vexp = 500000 -- VIP Exp
	cfg.exp = 250000 -- Regular Exp
	cfg.storage = 1337 -- VIP Storage
	cfg.max = 250 -- Max Level
	cfg.msg = "You have been awarded experience from " .. getCreatureName(cid) .. " for a mistake."
	for _, pid in ipairs(getPlayersOnline()) do
		if getNotationsCount(getPlayerAccount(pid)) > 1 then
			return false
		elseif getPlayerLevel(pid) >= cfg.max then
			return false
		elseif getPlayerStorageValue(pid, cfg.storage) == -1 then
			doPlayerAddExperience(pid, cfg.exp)
		else
			doPlayerAddExperience(pid, cfg.vexp)
		end
		doBroadcastMessage(cfg.msg, MESSAGE_STATUS_EVENT)
		return true
	end
end
 
When I saw "universal" as the title name, I thought of the whole server. Perhaps this can be used for a mistake that a gamemaster made.
I haven't tested this, but it might work. If not, it's a start to something new. :thumbup:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {}
	cfg.vexp = 500000 -- VIP Exp
	cfg.exp = 250000 -- Regular Exp
	cfg.storage = 1337 -- VIP Storage
	cfg.max = 250 -- Max Level
	cfg.msg = "You have been awarded experience from " .. getCreatureName(cid) .. " for a mistake."
	for _, pid in ipairs(getPlayersOnline()) do
		if getNotationsCount(getPlayerAccount(pid)) > 1 then
			return false
		elseif getPlayerLevel(pid) >= cfg.max then
			return false
		elseif getPlayerStorageValue(pid, cfg.storage) == -1 then
			doPlayerAddExperience(pid, cfg.exp)
		else
			doPlayerAddExperience(pid, cfg.vexp)
		end
		doBroadcastMessage(cfg.msg, MESSAGE_STATUS_EVENT)
		return true
	end
end

Would getCreatureName(cid) not return the player's own name? So if a GM were to award it then it'd still say "You received experience from RazorBlade" or somethin like that? Considering I'm RazorBlade? xD Just a question.
 
It would return the name of the person using the scroll, which should be a gamemaster.

pid = online player names.
cid = person using scroll.
 
When I saw "universal" as the title name, I thought of the whole server. Perhaps this can be used for a mistake that a gamemaster made. I haven't tested this, but it might work. If not, it's a start to something new. :thumbup:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local cfg = {}
    cfg.vexp = 500000 -- VIP Exp
    cfg.exp = 250000 -- Regular Exp
    cfg.storage = 1337 -- VIP Storage
    cfg.max = 250 -- Max Level
    cfg.msg = "You have been awarded experience from " .. getCreatureName(cid) .. " for a mistake."
    for _, pid in ipairs(getPlayersOnline()) do
        if getNotationsCount(getPlayerAccount(pid)) > 1 then
            return false
        elseif getPlayerLevel(pid) >= cfg.max then
            return false
        elseif getPlayerStorageValue(pid, cfg.storage) == -1 then
            doPlayerAddExperience(pid, cfg.exp)
        else
            doPlayerAddExperience(pid, cfg.vexp)
        end
        doBroadcastMessage(cfg.msg, MESSAGE_STATUS_EVENT)
        return true
    end
end

Wont work correctly

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local cfg = {}
    cfg.vexp = 500000 -- VIP Exp
    cfg.exp = 250000 -- Regular Exp
    cfg.storage = 1337 -- VIP Storage
    cfg.max = 250 -- Max Level
    cfg.msg = "You have been awarded experience from " .. getCreatureName(cid) .. " for a mistake."
    for _, pid in ipairs(getPlayersOnline()) do
        if not getNotationsCount(getPlayerAccount(pid)) > 1 then
            if not getPlayerLevel(pid) >= cfg.max then
                if getPlayerStorageValue(pid, cfg.storage) == -1 then
                    doPlayerAddExperience(pid, cfg.exp)
                else
                    doPlayerAddExperience(pid, cfg.vexp)
                end
            end
        end
    end
    doBroadcastMessage(cfg.msg, MESSAGE_STATUS_EVENT)
    return true
end
 
Sharing is caring..


thanks on the behalf of the community. keep the scripts coming!
 
Back
Top