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

Vocation scroll

TomCrusher

Jeg er ingenting
Joined
Dec 31, 2008
Messages
663
Reaction score
19
Location
Norway
Hello i trying to write my first script and I'm newbie so I cannot excute it who can help me wit it???
PHP:
local config = {
	promotion = 2,	-- promotion level, default = 2 . Ignore if you don't have new vocations.
        oldpromotion = 1, -- back promotion level, default = 2
	minLevel = 20,	-- Level needed to buy promotion
	cost = 20000, 	-- Promotion cost in gp
	premium = "yes",  -- is premium needed to buy promotion?
        MaxTime = 20, --max time of promotion
        TimeStor = 18009 --here will be saved the time.
}

local disabledVocations = {0}

config.premium = getBooleanFromString(config.premium)

function onUse(cid, item, frompos, param, topos)
        if item.itemid == 9004 then
	        elseif(config.premium == TRUE and isPremium(cid) == FALSE) then
		       doPlayerSendCancel(cid, "You need a premium account.")
	        elseif(getPlayerPromotionLevel(cid) >= config.promotion) then
		       doPlayerSendCancel(cid, "You are already promoted.")
	        elseif(getPlayerLevel(cid) < config.minLevel) then
		       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. config.minLevel .. " to get promotion.")
        else
		setPlayerPromotionLevel(cid, config.promotion)
		doPlayerRemoveItem(cid, 9004, 1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been succesful promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
                setPlayerStorageValue(cid, config.TimeStor, os.time()+config.MaxTime)
	end
local PlayerTime = getPlayerStorageValue(Player, TimeStor)
        if PlayerTime - 10 <= os.time() then
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "you have "..PlayerTime - os.time().." seconds left.!")
        elseif PlayerTime == 0 <=os.time() then
        setPlayerPromotionLevel(cid, config.oldpromotion)
	end
	return TRUE
end
This is a scroll on use, u can get a new vocation but only with time expiries. What is wrong? Help me:D
 
Last edited:
What do you mean, that you want to make a scroll which allows you to be a diffrent vocation for a small period of time?
 
MaxTime = 20, --max time of promotion
TimeStor = 18009 --here will be saved the time.

What config i need edit for change duration for 30 days? tks nice script very nice!
 
MaxTime = 20, --max time of promotion
TimeStor = 18009 --here will be saved the time.

What config i need edit for change duration for 30 days? tks nice script very nice!

Sorry should be nice but don't work correctly i trying to excute it but all what I can do is only set promotion. I need help with os.time. Who can help to repair it?
 
Back
Top