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

TFS 0.X 8.60 0.4 Need Script Check Bless

XML:
    <talkaction words="!bless" script="bless.lua"/>

Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 500000 -- Cost in gp.
function onSay(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
        doPlayerSendTextMessage(cid,24, "You bought all blessing.")
        doSendMagicEffect(getPlayerPosition(cid), 28)
    else
        doPlayerSendCancel(cid, "You don't have enough money.")
    end
    return TRUE
end
 
Okay

XML:
<talkaction words="!checkbless" script="checkbless.lua" />

Lua:
local bless = {1, 2, 3, 4, 5}

function onSay(cid, words, param)
    local hasBlessings = false
    for i = 1, table.maxn(bless) do
        if getPlayerBlessing(cid, bless[i]) then
            hasBlessings = true
            break
        end
    end

    if hasBlessings then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have all bless.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Warrning ! You not have blessed use this command !bless ")
    end

    return true
end
 
Need message text e no script buy, need message text end bless like image
You can use the same one that the friend shared, just do it as globalevents, every 15 seconds check if the player has blessing or not, if not then skip that message.

something like this:
Lua:
local bless = {1, 2, 3, 4, 5}
function onThink(interval)
    local players = getPlayersOnline()
    for i, pid in ipairs(players) do
        for _, b in ipairs(bless) do
            if not getPlayerBlessing(pid, b) then
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "[Warning] - You are not blessed, use the command [!bless].")
                return true
            end
        end
    end
    return true
end

Code:
<globalevent name="checkbless" interval="15000" event="script" value="check_bless.lua"/>
 
@Fabi Marzan message on baseboard what is the broadcast message I'm using this script:

Lua:
function onLogin(cid)
    local bless = {"First Bless,", "Second Bless,", "Third Bless,", "Fourth Bless,", "Fifth Bless."}
    local check = "Received blessings: "
    local hasBlessings = false
    
    for i = 1, #bless do
        if getPlayerBlessing(cid, i) then
            check = check .. bless[i]
            hasBlessings = true
        end
    end

    if hasBlessings then
        doPlayerSendTextMessage(cid, 20, check)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "[Warning] - You are not blessed, use the command [!bless].")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "[Warning] - You are not blessed, use the command [!bless].")
  
    end

    return true
end
Screenshot_7.png
 
Last edited:
@Fabi Marzan message on baseboard what is the broadcast message
Lua:
doPlayerSendCancel(pid, "[Warning] - You are not blessed, use the command [!bless].")

take a look here:
Code:
MESSAGE_STATUS_CONSOLE_RED = 18, /*Red message in the console*/
MESSAGE_EVENT_ORANGE = 19, /*Orange message in the console*/
MESSAGE_STATUS_CONSOLE_ORANGE = 20,  /*Orange message in the console*/
MESSAGE_STATUS_WARNING = 21, /*Red message in game window and in the console*/
MESSAGE_EVENT_ADVANCE = 22, /*White message in game window and in the console*/
MESSAGE_EVENT_DEFAULT = 23, /*White message at the bottom of the game window and in the console*/
MESSAGE_STATUS_DEFAULT = 24, /*White message at the bottom of the game window and in the console*/
MESSAGE_INFO_DESCR = 25, /*Green message in game window and in the console*/
MESSAGE_STATUS_SMALL = 26, /*White message at the bottom of the game window"*/
MESSAGE_STATUS_CONSOLE_BLUE = 27, /*FIXME Blue message in the console*/
 
Lua:
doPlayerSendCancel(pid, "[Warning] - You are not blessed, use the command [!bless].")

take a look here:
Code:
MESSAGE_STATUS_CONSOLE_RED = 18, /*Red message in the console*/
MESSAGE_EVENT_ORANGE = 19, /*Orange message in the console*/
MESSAGE_STATUS_CONSOLE_ORANGE = 20,  /*Orange message in the console*/
MESSAGE_STATUS_WARNING = 21, /*Red message in game window and in the console*/
MESSAGE_EVENT_ADVANCE = 22, /*White message in game window and in the console*/
MESSAGE_EVENT_DEFAULT = 23, /*White message at the bottom of the game window and in the console*/
MESSAGE_STATUS_DEFAULT = 24, /*White message at the bottom of the game window and in the console*/
MESSAGE_INFO_DESCR = 25, /*Green message in game window and in the console*/
MESSAGE_STATUS_SMALL = 26, /*White message at the bottom of the game window"*/
MESSAGE_STATUS_CONSOLE_BLUE = 27, /*FIXME Blue message in the console*/
this is a briliant how your message been ignored XD

@topic
solution is already posted by @Fabi Marzan and @Mtx69
 

Similar threads

Back
Top