<talkaction words="!bless" script="bless.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
<talkaction words="!checkbless" script="checkbless.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
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.Need message text e no script buy, need message text end bless like image
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
<globalevent name="checkbless" interval="15000" event="script" value="check_bless.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
@Fabi Marzan message on baseboard what is the broadcast message
doPlayerSendCancel(pid, "[Warning] - You are not blessed, use the command [!bless].")
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 XDLUA: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*/