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

[8.60] !promotion and !bless command

Abbeh

New Member
Joined
Nov 22, 2012
Messages
98
Reaction score
1
Location
Sweden, Gothenburg
Good evening,

Is there anyone that has a working "!promotion" and a working "!bless" talkaction script?

Code:
local aol_otswe = {
cost = 10000,
buy_text = "You have bought an Amulet of Loss! You are now protected against item loss as long as you wear it.",
cancel_text = "Sorry but you can't afford an Amulet of Loss.",
effect = 49
}
 
local bless_otswe = {
cost = 15000,
cancel_text = "Sorry, but you have already been blessed by the gods!",
buy_text = "You have been blessed by the gods!",
effect = CONST_ME_HOLYDAMAGE,
cancel_text_onbuy = "Sorry, but you can't afford the blessings!"
}
 
function onSay(cid, words, param)
if words == "!aol" then
   if doPlayerRemoveMoney(cid, aol_otswe.cost) == TRUE then 
   doPlayerAddItem(cid,2173,1)
   doSendMagicEffect(getPlayerPosition(cid), aol_otswe.effect)
   doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, aol_otswe.buy_text)
    else 
   doPlayerSendCancel(cid, aol_otswe.cancel_text) 
   end
   return true
  end 
end
 
if words == "!bless" then
if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
   doPlayerSendCancel(cid,bless_otswe.cancel_text)
    else
        if doPlayerRemoveMoney(cid, bless_otswe.cost) == TRUE then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
	    doSendMagicEffect(getPlayerPosition(cid), bless_otswe.effect)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,bless_otswe.buy_text)
        else
            doPlayerSendCancel(cid, "bless_otswe.cancel_text_onbuy")
        end
    end 
  return true
end

This code makes "!aol" works, but not "!bless"..
 
Last edited:
LUA CODE

Lua:
function onSay(cid, words, param)
local fail = 0

	if getPlayerLevel(cid) < 31 then
		cost = 2000
	else
		cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
	end
	
	if cost > 20000 then
		cost = 20000
	end

	for i = 1, 5 do
		if getPlayerBlessing(cid, i) then
			fail = fail + 1
		else
			if doPlayerRemoveMoney(cid, cost) == TRUE then
				doPlayerAddBlessing(cid, i)
				if i == 5 and not(fail == 5) then
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
				end
			else
				doPlayerSendCancel(cid, "You do not have enough money to buy all the blessings!")
				break
			end
		end
	end
	if fail == 5 then
		doPlayerSendCancel(cid, "You already have all the blessings!")
	end
return TRUE
end

XML CODE


Lua:
<talkaction words="!bless" event="script" value="bless.lua"/>

Hope this Helps!
 
Well here's promotion,

Code:
local config = {
promotion = 1, -- promotion level, default = 1 . Ignore if you don't have new vocations.
minLevel = 20, -- Level needed to buy promotion
cost = 20000, -- Promotion cost in gp
premium = "yes" -- is premium needed to buy promotion?
}

local disabledVocations = {0}

config.premium = getBooleanFromString(config.premium)

function onSay(cid, words, param)
if(isInArray(disabledVocations, getPlayerVocation(cid)) == TRUE) then
doPlayerSendCancel(cid, "Your vocation cannot buy promotion.")
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.")
elseif(doPlayerRemoveMoney(cid, config.cost) ~= TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You do not have enought money! (Promotion cost " .. config.cost .. " gp.")
else
setPlayerPromotionLevel(cid, config.promotion)
doSendAnimatedText(getCreaturePosition(cid), '*Promoted*', TEXTCOLOR_RED)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been succesful promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
end
return TRUE
end
 
Back
Top