• 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
 
it doesn't have to be true, in fact blessings won't work if it's true but freePremium is false and player has no premium
(which is obvious)
 
it doesn't have to be true, in fact blessings won't work if it's true but freePremium is false and player has no premium
(which is obvious)

here is my settings


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

its working but i want make blessing does not touch lose_items
meaning if player with blessings or no he lose items when he die

also i want explain of these lines

blessingReductionBase = 30
blessingReductionDecrement = 5
pvpBlessingThreshold = 40
fairFightTimeRange = 60
 
Heres the simply script =)

LUA:
local cc = 30

function onSay(cid, words, param, channel)
	if getPlayerBlessing(cid, 5) then
		doCreatureSay(cid, 'You are already blessed!', TALKTYPE_ORANGE_1, false, cid)
	elseif doPlayerRemoveMoney(cid, cc * 10000) == false then
		doCreatureSay(cid, 'You need ' .. cc .. ' cc to get blessed!', TALKTYPE_ORANGE_1, false, cid)
	else
		for i = 1, 5 do
			doPlayerAddBlessing(cid, i)
		end
		doCreatureSay(cid, 'You have been blessed for ' .. cc .. ' cc!', TALKTYPE_ORANGE_1, false, cid)
	end
	return true
end

this 1 cost 30cc u may change if u want to :D
 
Back
Top