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

Instant Bless

Arita

:))
Joined
Dec 26, 2010
Messages
47
Reaction score
3
Location
Mexiiico!! :)
Hey Otland! I have a little problem with a script.. the thing is.. i want that ALL players get ALL the blesses when they log in, so i have this script in login.lua:

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

function onLogin(cid)
	[COLOR="red"]local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) and getPlayerVocation(cid) ~= 0 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 0)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 2)
		doPlayerSetPromotionLevel(cid, 1)

	end
[/COLOR]
	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 .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		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, "Idle")
	registerCreatureEvent(cid, "SkullCheck")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "FragReward")
	registerCreatureEvent(cid, "LevelRebalance")
	registerCreatureEvent(cid, "Lowlevellock")
	registerCreatureEvent(cid, "StartSkills")
	return true
end

Also, i have this Error in my console

Code:
[27/12/2010 00:16:55] Lua Script Error: [Test Interface] 
[27/12/2010 00:16:55] data/creaturescripts/scripts/login.lua
[27/12/2010 00:16:55] data/creaturescripts/scripts/login.lua:2: attempt to call global 'getConfigValue' (a nil value)
[27/12/2010 00:16:55] stack traceback:
[27/12/2010 00:16:55] 	[C]: in function 'getConfigValue'
[27/12/2010 00:16:55] 	data/creaturescripts/scripts/login.lua:2: in main chunk
[27/12/2010 00:16:55] Warning: [Event::checkScript] Can not load script. /scripts/login.lua

Can somebody helpme?
 
Last edited:
Code:
local config = {
	loginMessage = getConfigValue('loginMessage')
}

function onLogin(cid)
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 0)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 2) 
		doPlayerSetPromotionLevel(cid, 1)

Why add 2 premium days every time they log in? just set in config as "free premium"
if they're having their loss set at 0% why add the blessings in the first place?

This script makes no sense at all, I've removed the config check 'cos its pointless
 
@tosuxo
It will give error since loss is not declared in line 6..
But since you multiply with 0 you can set simply 0 there xD

@arita
Server version?
 
so... is going to be like this?:

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

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) and getPlayerVocation(cid) ~= 0 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 0)
		doPlayerSetPromotionLevel(cid, 1)

	end
 
so... is going to be like this?:

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

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) and getPlayerVocation(cid) ~= 0 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 0)
		doPlayerSetPromotionLevel(cid, 1)

	end

10 * 0 = 0
10000000 * 0 = 0
pointless bit of code there, just set it as:
Code:
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
 
Weird script.
Try:
Lua:
function onLogin(cid)
for i = 1, 5 do
    if getPlayerBlessing(cid,i) then
       return true
    else      
        doPlayerAddBlessing(cid,i)
    end
end
return true
end

Or

Lua:
function onLogin(cid)
for i = 1, 5 do     
doPlayerAddBlessing(cid,i)
end
return true
end
 
still doesnt work :S:
Console
Code:
[27/12/2010 15:47:26] Lua Script Error: [Test Interface] 
[27/12/2010 15:47:26] data/creaturescripts/scripts/login.lua
[27/12/2010 15:47:26] data/creaturescripts/scripts/login.lua:2: attempt to call global 'getConfigValue' (a nil value)
[27/12/2010 15:47:26] stack traceback:
[27/12/2010 15:47:26] 	[C]: in function 'getConfigValue'
[27/12/2010 15:47:26] 	data/creaturescripts/scripts/login.lua:2: in main chunk
[27/12/2010 15:47:26] Warning: [Event::checkScript] Can not load script. /scripts/login.lua

Login.lua

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

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) and getPlayerVocation(cid) ~= 0 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 0)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 0)
		doPlayerSetPromotionLevel(cid, 1)

	end
 
In case it's a 0.2 server.
Lua:
function onLogin(cid)
	if not getPlayerBlessing(cid, 1) then
		for i = 1, 5 do
			doPlayerAddBlessing(cid, i)
		end
	end
	return TRUE
end
 
still doesnt work now i have this error in my console:

Code:
[27/12/2010 16:17:52] Warning: [Event::checkScript] Can not load script. /scripts/login.lua
[27/12/2010 16:17:52] data/creaturescripts/scripts/login.lua:48: '<eof>' expected near 'end'

login.lua

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

function onLogin(cid)
	if not getPlayerBlessing(cid, 1) then
		for i = 1, 5 do
			doPlayerAddBlessing(cid, i)
		end
	end
	return TRUE
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 .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		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, "Idle")
	registerCreatureEvent(cid, "SkullCheck")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "FragReward")
	registerCreatureEvent(cid, "LevelRebalance")
	registerCreatureEvent(cid, "Lowlevellock")
	registerCreatureEvent(cid, "StartSkills")
	return true
end
 
Code:
local config = {
	loginMessage = getConfigValue('loginMessage')
}

function onLogin(cid)
	if not getPlayerBlessing(cid, 1) then
		for i = 1, 5 do
			doPlayerAddBlessing(cid, i)
		end
	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 .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		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, "Idle")
	registerCreatureEvent(cid, "SkullCheck")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "FragReward")
	registerCreatureEvent(cid, "LevelRebalance")
	registerCreatureEvent(cid, "Lowlevellock")
	registerCreatureEvent(cid, "StartSkills")
	return true
end

you had an end too early ;)
 
Code:
[27/12/2010 17:03:21] Lua Script Error: [Test Interface] 
[27/12/2010 17:03:21] data/creaturescripts/scripts/login.lua
[27/12/2010 17:03:21] data/creaturescripts/scripts/login.lua:2: attempt to call global 'getConfigValue' (a nil value)
[27/12/2010 17:03:21] stack traceback:
[27/12/2010 17:03:21] 	[C]: in function 'getConfigValue'
[27/12/2010 17:03:21] 	data/creaturescripts/scripts/login.lua:2: in main chunk
[27/12/2010 17:03:21] Warning: [Event::checkScript] Can not load script. /scripts/login.lua

This Never ends!!! :( no one knows how to fix it?
 
You ever tought about removing this:
Lua:
local config = {
	loginMessage = getConfigValue('loginMessage')
}
Since it is in line 2 and your console always screams: LINE 2 FIX ME
Also remove the part where loginMessage is needed.
 
still doesnt work now i have this error in my console:

Code:
[27/12/2010 16:17:52] Warning: [Event::checkScript] Can not load script. /scripts/login.lua
[27/12/2010 16:17:52] data/creaturescripts/scripts/login.lua:48: '<eof>' expected near 'end'
You didn't paste it properly, you were supposed to replace everything with it.
 
Back
Top