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

Drops item with bless

vingo

Active Member
Joined
Oct 27, 2012
Messages
464
Reaction score
43
Im using TFS 1.0, MarkSamman forgottenserver from github, but people are dropping items when dying with bless, why is this?
 
well, I have automatic bless to level 70,


PHP:
local freeBlessMaxLevel = 70
function onLogin(cid)
    if(getPlayerLevel(cid) <= freeBlessMaxLevel and not getPlayerBlessing(cid,1)) then
        for b=1, 5 do
            doPlayerAddBlessing(cid, b)
        end
        doCreatureSay(cid, 'You got free bless, because your level is lower than 70', TALKTYPE_ORANGE_1)
        elseif(getPlayerBlessing(cid,1)) then
    doCreatureSay(cid, 'You are bleesed!', TALKTYPE_ORANGE_1)
    else
    doCreatureSay(cid, 'You are not bleesed. type !bless', TALKTYPE_ORANGE_1)
    end
    return true
end
 
Code:
local freeBlessMaxLevel = 70
function onLogin(cid)
    if(getPlayerLevel(cid) <= freeBlessMaxLevel and not getPlayerBlessing(cid,1)) then
        for b=1, 6 do
            doPlayerAddBlessing(cid, b)
        end
        doCreatureSay(cid, 'You got free bless, because your level is lower than 70', TALKTYPE_ORANGE_1)
        elseif(getPlayerBlessing(cid,1)) then
    doCreatureSay(cid, 'You are bleesed!', TALKTYPE_ORANGE_1)
    else
    doCreatureSay(cid, 'You are not bleesed. type !bless', TALKTYPE_ORANGE_1)
    end
    return true
end

Test and say for me if work.
 
here is talkaction

PHP:
function onSay(cid, words, param)
    local cost = getBlessingsCost(getPlayerLevel(cid))
    if (isPlayerPzLocked(cid) == FALSE) then
        if (getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5)) then
            doPlayerSendCancel(cid,"You have already been blessed by the gods.")
            return false
        end
        if (doPlayerRemoveMoney(cid,cost)) then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been blessed by the 5 gods!")
        else
            doPlayerSendCancel(cid,"You need "..cost.." gold coins to buy all 5 bless.")
        end
    else
        doPlayerSendCancel(cid,"You can't buy bless, when you are in a battle.")
    end
    return false
end
 
Take a look at the blessing column in players table (phpMyAdmin), it should be either 31 or 63 (5 blessings + twist of fate).
 
It says 32

if (!lastHitPlayer || blessings < 32) {

if (lastHitPlayer) {
bitset.reset(5);
blessings = bitset.to_ulong();
} else {
blessings = 32;
}
} else {
blessings = 0;
}


PHP:
    std::bitset<5> bitset(blessings);
    switch (bitset.count()) {
        case 1:
            dropPercent = 70;
            break;

        case 2:
            dropPercent = 45;
            break;

        case 3:
            dropPercent = 25;
            break;

        case 4:
            dropPercent = 10;
            break;

        case 5:
            dropPercent = 0;
            break;

        default:
            dropPercent = 100;
            break;
 
Ah, They had 31 in phpmyadmin

I changed it so it gives 6 blesses up to level 70 which means they have 100% protection I guess.


But how do i add in !bless command so they get all blessings aswell?
 
Back
Top