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

Promotion + Bless = Need Scripts!

vegaseek

Member
Joined
Dec 11, 2010
Messages
146
Reaction score
8
I need a script that makes up every player who logs on to the server gets a promotion. And a script that gives all players endless blessings (eg, when a player falls does not drop his backpack, etc.). Please Scripts Tibia 8.7!
 
Here's the promotion script.


data/creaturescripts/scripts/promotionlogin.lua

Lua:
function onLogin(cid)
       if getPlayerVocation(cid) < 5 then
     doPlayerSendTextMessage(cid,22,"You are now promoted, Congratulations!")
               doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
        end
end


data/creaturescripts/creaturescripts.xml add this line:

XML:
<event type="login" name="PromotionLogin" script="promotionlogin.lua"/>



data/creaturescripts/scripts/login.lua add this



Lua:
registerCreatureEvent(cid, "PromotionLogin")
 
config.lua

PHP:
	-- Blessings
	blessingOnlyPremium = true
	blessingReductionBase = 30
	blessingReductionDecreament = 5
	eachBlessReduction = 10

data/talkactions/sripts

bless

PHP:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 100000) == TRUE then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 10 crystal coin to get blessed!")
        end
    end    
    return 1
end

PHP:
<talkaction words="!bless" event="script" value="bless.lua"/>
 
data/creaturescripts/scripts/blesslogin.lua
Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 0

function onLogin(cid, words, param)
    for i = 1, table.maxn(bless) do
        if(getPlayerBlessing(cid, bless[i])) then
            doPlayerSendCancel(cid, "You have already all blessings.")
            return TRUE
        end
    end
   
    if(doPlayerRemoveMoney(cid, cost) == TRUE) then
        for i = 1, table.maxn(bless) do
            doPlayerAddBlessing(cid, bless[i])
        end
        doCreatureSay(cid, "You are now blessed!" ,19)
        doSendMagicEffect(getPlayerPosition(cid), 49)
    else
        doPlayerSendCancel(cid, "You don't have enough money.")
    end
    return TRUE
end

data/creaturescripts/creaturescripts.xml
XML:
<event type="login" name="BlessLogin" script="blesslogin.lua"/>

data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "BlessLogin")

Im nooby but maybe it will work ;D
 
LOL - Zysen - your script broken...


not allowed to log on the server as I have enabled your script, / sorry man, /
 
Last edited:
Mhamad does not understand me ;/

Thank you very Sweddy d I would give you reputations but invisible as, / THX

Unfortunately, the script still needs a promotion for logging because that broken; / blocks seen on the server.
 
data/creaturescripts/scripts/promotionlogin.lua
Lua:
local config = {
	promotion = 1,	-- promotion level, default = 1 . Ignore if you don't have new vocations.
	minLevel = 1,	-- Level needed to buy promotion
	cost = 0, 	-- Promotion cost in gp
	premium = "no"  -- is premium needed to buy promotion?
}

local disabledVocations = {0}

config.premium = getBooleanFromString(config.premium)

function onLogin(cid, words, param)
	if(isInArray(disabledVocations, getPlayerVocation(cid)) == TRUE) then
		doPlayerSendCancel(cid, "Your vocation cannot gain 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)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been succesful promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
	end
	return TRUE
end

data/creaturescripts/creaturescripts.xml
XML:
<event type="login" name="PromotionLogin" script="promotionlogin.lua"/>

data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "PromotionLogin")


Im not a scripter but im just changing scripts to work the style you want.
 
look --->
oq15wl.jpg
 
Unfortunately, bless your script does not help me, / but it works items fall out normally, / even if it is August aola. And as for the script is broken for promotions the following functions (getBooleanFromString). When someone on my server will crash and pops konienko "You Are Dead." ok when you get some debug.! Please help me! AND I NEED SCRIPT FOR CLIENT 8.7 ;/

PS: Sorry for bad english ;/
 
data/creaturescripts/scripts/promotionlogin.lua

Lua:
unction onLogin(cid)
  local freePromotion = getConfigInfo('premiumForPromotion')
   if freePromotion == "NO" and getPlayerStorageValue(cid, 43545) == -1 then
        setPlayerPromotionLevel(cid, 1)
	setPlayerStorageValue(cid, 43545, 1)
    end
  return TRUE
end

data/creaturescripts/creaturescripts.xml

XML:
<event type="login" name="PromotionLogin" script="promotionlogin.lua"/>

data/creaturescripts/scripts/login.lua

Lua:
registerCreatureEvent(cid, "PromotionLogin")
 
Very good! The script works great, thanks. But I still do not have a script on the blessings (that is, you log it is written already ~ All bless), but when I drop things and fall out normally when you log in again want to let it get debug. Please help quickly!


LOL! The script for your time promotion works and sometimes does not work .... Please fix it so that gave the promotion of every form on the server and give advice to bless too! Please!
 
Last edited:
Back
Top