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

Free bless until x Level error!

Mestor

Active Member
Joined
Feb 1, 2009
Messages
515
Reaction score
34
Location
Sweden
Hello im looking for a script that gives the players free blessings until level 50 so they dont drop items.

I have been looking around and found some scripts... but they just gave me error.

one of them was in login.lua: (added it under function onLogin(cid))
Code:
local level = 50

function onLogin(cid)
if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have All blessings.")
else
for i = 1, 5 do
doPlayerAddBlessing(cid, i)
end
return true
end

But got this error:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/login.lua:onLogin
data/creaturescripts/scripts/others/login.lua:4: attempt to call global 'getPlayerBlessinggetPlayerBlessing' (a nil value)
stack traceback:
        [C]: in function 'getPlayerBlessinggetPlayerBlessing'
        data/creaturescripts/scripts/others/login.lua:4: in function <data/creaturescripts/scripts/others/login.lua:1>
 
Code:
local level = 50

function onLogin(cid)
   local player = Player(cid)
   local bless = {1, 2, 3, 4, 5}
   for i = 1, table.maxn(bless) do
     if player:hasBlessing(bless[i]) then
       player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "You have All blessings.")
     else
       player:addBlessing(bless[i])
     end
   end
   return true
end

Hopefully this works. I wrote it pretty quick. I stuck to your code as closely as possible.
Red
 
Code:
local level = 50

function onLogin(cid)
   local player = Player(cid)
   local bless = {1, 2, 3, 4, 5}
   for i = 1, table.maxn(bless) do
     if player:hasBlessing(bless[i]) then
       player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "You have All blessings.")
     else
       player:addBlessing(bless[i])
     end
   end
   return true
end

Hopefully this works. I wrote it pretty quick. I stuck to your code as closely as possible.
Red
Thank you Red, I didn't get any errors... but I didn't work too xD

10:24 No blessings received. Tested on level 8.
 
creaturescripts.xml

Code:
<event type="login" name="freebless" script="others/freebless.lua"/>

in data/creaturescripts/other put freebless.lua
Code:
function onLogin(cid)
if getPlayerLevel(cid) <= 50 and getPlayerVocation(cid) > 0 then
for k = 1, 5 do
doPlayerAddBlessing(cid, k)
end
end
return TRUE
end

in login.lua put:
Code:
registerCreatureEvent(cid, "freebless")
 
creaturescripts.xml

Code:
<event type="login" name="freebless" script="others/freebless.lua"/>

in data/creaturescripts/other put freebless.lua
Code:
function onLogin(cid)
if getPlayerLevel(cid) <= 50 and getPlayerVocation(cid) > 0 then
for k = 1, 5 do
doPlayerAddBlessing(cid, k)
end
end
return TRUE
end

in login.lua put:
Code:
registerCreatureEvent(cid, "freebless")
Worked! Thank you so much!

But is it maybe possible to add a text that will tell the player that he received it?
 
Worked! Thank you so much!

But is it maybe possible to add a text that will tell the player that he received it?

Try this:
Code:
function onLogin(cid)
if getPlayerLevel(cid) <= 800 and getPlayerVocation(cid) > 0 then
    for k = 1, 5 do
    doPlayerAddBlessing(cid, k)
    end
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ALL blessings!")
end
return TRUE
end

@Mestor edited it
 
Last edited:
Try this:
Code:
function onLogin(cid)
if getPlayerLevel(cid) <= 80 and getPlayerVocation(cid) > 0 then
for k = 1, 5 do
doPlayerAddBlessing(cid, k)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ALL blessings!")
end
end
return TRUE
end
It's good but it spammed it 5 times since it's 5 blessings, can you rather make it so it only tells it once? :)
 
take this :D

Code:
local freeBlessMaxLevel = 80   --- your max lvl to get free bless
function onLogin(cid)
    if(getPlayerLevel(cid) <= freeBlessMaxLevel and not getPlayerBlessing(cid,1)) then
        for b=1, 5 do
            doPlayerAddBlessing(cid, b)   --- here it add the bless
        end
        doCreatureSay(cid, 'You got free bless, because your level lower than 80', TALKTYPE_ORANGE_1)   --- info why he get bless
        doSendMagicEffect(getThingPosition(cid), CONST_ME_HOLYDAMAGE)
        elseif(getPlayerBlessing(cid,1)) then
    doCreatureSay(cid, 'You are blessed!', TALKTYPE_ORANGE_1)
    else
    doCreatureSay(cid, 'You are not blessed. type !bless', TALKTYPE_ORANGE_1)
    end
    return true
end
 
Back
Top