• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Problem with my !bless script!

Zaul

I'm The Devil Scripter
Joined
May 13, 2012
Messages
233
Reaction score
4
Hello i have check if the player get 31 in blessings in database. And yes i have set loss_items loss_experience and all with name loss to 100. So now i wonder what is the problem if a player die and downgrade from level 250 to level 1 ?

EDIT: Yes i have search about this but i didnt find any answer!

Here is my scripts!

bless.lua
PHP:
function onSay(cid, words, param)
 
	if getPlayerBlessing(cid,5) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
	else
		if doPlayerRemoveMoney(cid, 50000) == TRUE then
			for i = 1,5 do
				doPlayerAddBlessing(cid,i)
			end
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
		end
	end
	return TRUE
end

login.lua
PHP:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	if(getPlayerAccess(cid) > 0) then
		registerCreatureEvent(cid, "TutorNote")
	end
	registerCreatureEvent(cid, "inquisitionPortals")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	registerCreatureEvent(cid, "ArenaKill")
	registerCreatureEvent(cid, "reward")
	registerCreatureEvent(cid, "PythiusTheRotten")
	
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena  
	return true
end
 
PHP:
deathLostPercent = 5
blessings = true
	blessingOnlyPremium = false
	blessingReductionBase = 30
	blessingReductionDecrement = 5
	eachBlessReduction = 8

Thats my config!
 
bump! i need help again everytime someone relog they need to do !bless again? what?

and yes i use blessings = false in config.lua because if i use true there and if the player die they go back to level 1

i use this script now!

PHP:
-- !blessing by artofwork
local bless = {1, 2, 3, 4, 5}
local cost = 10000 -- each bless

function onSay(cid, words, param)
	local blessToAdd = {};

	for i,num in ipairs(bless) do
		if(not getPlayerBlessing(cid, num)) then
			table.insert(blessToAdd,num);
		end
	end
    
	if(#blessToAdd == 0)then
		doPlayerSendTextMessage(cid,22,"You are already blessed!")
		return true;
	end
	if(doPlayerRemoveMoney(cid, cost*#blessToAdd))then
		for _,num in ipairs(blessToAdd) do	
			doPlayerAddBlessing(cid, num);
		end
	else
		doPlayerPopupFYI(cid, "You need "..(cost*#blessToAdd).." to buy blessings.")
		return true;
	end
	doPlayerSendTextMessage(cid,22,"You have been successfully blessed.!")
	return false;
end
 
Make New One ///
Add this line in /data/talkactions/talkactions.xml
PHP:
<talkaction access="0" log="no" filter="word" words="!bless" script="bless.lua" />
Then create a new .lua file and call it bless.lua
Code:
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, 50000) == 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 50k to get blessed!")
        end
    end    
    return 1
end
Rep+
 
I was not askin for AOL sorry for my bad english but i wonder if the script add so people do not drop the items!
 
It gives you all five blesses which prevents your character from dropping items. (not red skull though).
 
Okey thank you! :P

EDIT: When i logout i can do !bless again is this is a bug? I did !bless before i logout!
 
Last edited:
Now i have solved it with Cykotitans help! So just set blessings = true and deathlostpercent = 10 and use the bless.lua and all will work.

+ all with name loss_ in database set them to 100
 
so is it right ?

blessings = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecrement = 5
eachBlessReduction = 8
pvpBlessingThreshold = 40
fairFightTimeRange = 60

or which one of these option means ?
 
Back
Top