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

Lua Blessings first time you login

Og1999

New Member
Joined
Apr 1, 2015
Messages
34
Reaction score
1
Hello guys!

I've been looking around for scripts for blessings for new chars. When you create a character and log in for the first time, you should recieve full blessings.

Anyone can help me with this?

Im using TFS 0.4 SVN
 
Use this instead! Put it inside your data/creaturescripts/scripts/login.lua right after first line function onLogin(cid).
Code:
local storage = 54321
if storage == nil or storage == -1 then
    for i = 1, 5 do
        doPlayerAddBlessing(cid, i)
    end
    doPlayerSetStorageValue(cid, storage, 1)
end
Xeraphus' code will give everyone blessing everytime he or she logins.
 
Use this instead! Put it inside your data/creaturescripts/scripts/login.lua right after first line function onLogin(cid).
Code:
local storage = 54321
if storage == nil or storage == -1 then
    for i = 1, 5 do
        doPlayerAddBlessing(cid, i)
    end
    doPlayerSetStorageValue(cid, storage, 1)
end
Xeraphus' code will give everyone blessing everytime he or she logins.
storages cant be nil by default lol
also if you're putting it in default login.lua put the loop under the lastLogin part of the code instead of using storage
 
Use this instead! Put it inside your data/creaturescripts/scripts/login.lua right after first line function onLogin(cid).
Code:
local storage = 54321
if storage == nil or storage == -1 then
    for i = 1, 5 do
        doPlayerAddBlessing(cid, i)
    end
    doPlayerSetStorageValue(cid, storage, 1)
end
Xeraphus' code will give everyone blessing everytime he or she logins.

Nothing happends when i put the script in login.lua.
This is my login.lua I have tried everything now. So i really have tried haha. I not lazy if you think that :) Really
appreciates your help!

Code:
function onLogin(cid)

local BLESSINGS, amount, missing = {"Wisdom of Solitude", "Spark of the Phoenix", "Fire of the Suns", "Spiritual Shielding", "Embrace of Tibia"}, 0, {}

for i = 1, 5 do
if getPlayerBlessing(cid, i) then amount = (amount+1) else table.insert(missing, BLESSINGS) end
end
if amount == 1 then s='' else s='s' end

doPlayerSendTextMessage(cid,20,'You have '..amount..' blessing'..s..' ('.. amount*20 ..'%).\nMissing blessings: '..table.concat(missing, ", "))
return true
end

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 .. " Welcome to Natura!"
       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, "BlessCheck")
   registerCreatureEvent(cid, "Advance")
   registerCreatureEvent(cid, "ReportBug")
   registerCreatureEvent(cid, "AdvanceSave")
   registerCreatureEvent(cid, "VipCheck")
   registerCreatureEvent(cid, "TempleTeleporter")
   registerCreatureEvent(cid, "forever amulet")
   registerCreatureEvent(cid, "skull amulet")
   registerCreatureEvent(cid, "charge amulet")
    registerCreatureEvent(cid, "SpellUp")
    registerCreatureEvent(cid, "rebirth")
   registerCreatureEvent(cid, "maxlvl")
   registerCreatureEvent(cid, "Aol")
   registerCreatureEvent(cid, "PWNED")
   registerCreatureEvent(cid, "InfoAdv")
   registerCreatureEvent(cid, "InfoDeath")
   registerCreatureEvent(cid, "summonDeath")
   registerCreatureEvent(cid, "onPrepareDeath")
   registerCreatureEvent(cid, "PlayerDeath")
   registerCreatureEvent(cid, "ZombieAttack")
   registerCreatureEvent(cid, "LMSSummon")
   registerCreatureEvent(cid, "LMSAttack")
   registerCreatureEvent(cid, "LMSTarget")
   registerCreatureEvent(cid, "CreateTeleport")
  
   registerCreatureEvent(cid, "Idle")
   if(config.useFragHandler) then
       registerCreatureEvent(cid, "SkullCheck")
   end
   return true
end
 
use the script i posted.
i said where to put it
I did. I posted it in login.lua i still dont recieve blessings when a new char login...
Here is my login.lua

Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    for i = 1, 5 do
        doPlayerAddBlessing(cid, i)
    end
    return true
end

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 .. " Welcome to Natura!"
       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, "BlessCheck")
   registerCreatureEvent(cid, "Advance")
   registerCreatureEvent(cid, "ReportBug")
   registerCreatureEvent(cid, "AdvanceSave")
   registerCreatureEvent(cid, "VipCheck")
   registerCreatureEvent(cid, "TempleTeleporter")
   registerCreatureEvent(cid, "forever amulet")
   registerCreatureEvent(cid, "skull amulet")
   registerCreatureEvent(cid, "charge amulet")
    registerCreatureEvent(cid, "SpellUp")
    registerCreatureEvent(cid, "rebirth")
   registerCreatureEvent(cid, "maxlvl")
   registerCreatureEvent(cid, "Aol")
   registerCreatureEvent(cid, "PWNED")
   registerCreatureEvent(cid, "InfoAdv")
   registerCreatureEvent(cid, "InfoDeath")
   registerCreatureEvent(cid, "summonDeath")
   registerCreatureEvent(cid, "onPrepareDeath")
   registerCreatureEvent(cid, "PlayerDeath")
   registerCreatureEvent(cid, "ZombieAttack")
   registerCreatureEvent(cid, "LMSSummon")
   registerCreatureEvent(cid, "LMSAttack")
   registerCreatureEvent(cid, "LMSTarget")
   registerCreatureEvent(cid, "CreateTeleport")
   
   registerCreatureEvent(cid, "Idle")
   if(config.useFragHandler) then
       registerCreatureEvent(cid, "SkullCheck")
   end
   return true
end
[CODE\]
 
I did. I posted it in login.lua i still dont recieve blessings when a new char login...
Here is my login.lua

Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    for i = 1, 5 do
        doPlayerAddBlessing(cid, i)
    end
    return true
end

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 .. " Welcome to Natura!"
       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, "BlessCheck")
   registerCreatureEvent(cid, "Advance")
   registerCreatureEvent(cid, "ReportBug")
   registerCreatureEvent(cid, "AdvanceSave")
   registerCreatureEvent(cid, "VipCheck")
   registerCreatureEvent(cid, "TempleTeleporter")
   registerCreatureEvent(cid, "forever amulet")
   registerCreatureEvent(cid, "skull amulet")
   registerCreatureEvent(cid, "charge amulet")
    registerCreatureEvent(cid, "SpellUp")
    registerCreatureEvent(cid, "rebirth")
   registerCreatureEvent(cid, "maxlvl")
   registerCreatureEvent(cid, "Aol")
   registerCreatureEvent(cid, "PWNED")
   registerCreatureEvent(cid, "InfoAdv")
   registerCreatureEvent(cid, "InfoDeath")
   registerCreatureEvent(cid, "summonDeath")
   registerCreatureEvent(cid, "onPrepareDeath")
   registerCreatureEvent(cid, "PlayerDeath")
   registerCreatureEvent(cid, "ZombieAttack")
   registerCreatureEvent(cid, "LMSSummon")
   registerCreatureEvent(cid, "LMSAttack")
   registerCreatureEvent(cid, "LMSTarget")
   registerCreatureEvent(cid, "CreateTeleport")
  
   registerCreatureEvent(cid, "Idle")
   if(config.useFragHandler) then
       registerCreatureEvent(cid, "SkullCheck")
   end
   return true
end
[CODE\]
i said put the script inside your default login.lua
you arent supposed to create a new function for it, there's already one for you
put it under the lastLogin part
Code:
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 .. " Welcome to Natura!"
       end
 
Back
Top