• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Creatureevent - message on login help please

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
I want a message including a short story to pop up in login, only 1 time, first time login.

I want the text to be in orange please


<3
 
Under:
Code:
function onLogin(cid)
Paste:

Code:
    if getPlayerLastLoginSaved(cid) == 0 then
    doPlayerPopupFYI(cid, "Welcome to our OT!\nAND YOUR STORY...")
    end
 
this is how it looks:
function onLogin(cid)
if getPlayerLastLoginSaved(cid) == 0 then
doPlayerPopupFYI(cid, "Welcome to our OT!\nAND YOUR STORY...")
end
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end




This is errors:
[02/08/2012 00:25:03] Lua Script Error: [CreatureScript Interface]
[02/08/2012 00:25:03] data/creaturescripts/scripts/login.lua:onLogin
[02/08/2012 00:25:03] data/creaturescripts/scripts/login.lua:2: attempt to call global 'getPlayerLastLoginSaved' (a nil value)
[02/08/2012 00:25:03] stack traceback:
[02/08/2012 00:25:03] [C]: in function 'getPlayerLastLoginSaved'
[02/08/2012 00:25:03] data/creaturescripts/scripts/login.lua:2: in function <data/creaturescripts/scripts/login.lua:1>
 
Create , first.lua

function onLogin(cid)
if getPlayerLastLoginSaved(cid) == 0 then
doPlayerPopupFYI(cid, "Welcome to our OT!\nAND YOUR STORY...")
end
return true
end

Add to your login.lua :

registerCreatureEvent(cid, "first")


creaturescripts.xml

<event type="login" name="first" event="script" value="first.lua"/>
 
Create , first.lua



Add to your login.lua :




creaturescripts.xml


[02/08/2012 00:42:15] Lua Script Error: [CreatureScript Interface]
[02/08/2012 00:42:15] data/creaturescripts/scripts/first.lua:onLogin
[02/08/2012 00:42:15] data/creaturescripts/scripts/first.lua:2: attempt to call global 'getPlayerLastLoginSaved' (a nil value)
[02/08/2012 00:42:15] stack traceback:
[02/08/2012 00:42:15] [C]: in function 'getPlayerLastLoginSaved'
[02/08/2012 00:42:15] data/creaturescripts/scripts/first.lua:2: in function <data/creaturescripts/scripts/first.lua:1>
[02/08/2012 00:42:15] Baloma has logged out.


:/ doesn't work
 
Try:

Add it to your login.lua


LUA:
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage 
        if(lastLogin > 0) then 
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) 
            str = .. getPlayerName .. ",Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." 
        else 
       doPlayerPopupFYI(cid, "Welcome to our OT!\nAND YOUR STORY...")
        end
 
Try:

Add it to your login.lua


LUA:
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage 
        if(lastLogin > 0) then 
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) 
            str = .. getPlayerName .. ",Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." 
        else 
       doPlayerPopupFYI(cid, "Welcome to our OT!\nAND YOUR STORY...")
        end




Code:
[02/08/2012 01:29:07] Warning: [Event::checkScript] Can not load script. /scripts/login.lua
[02/08/2012 01:29:07] data/creaturescripts/scripts/login.lua:5: unexpected symbol near '..'
 
LUA:
local config = {
	loginMessage = getConfigValue('loginMessage')
	}
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 
       		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "TYPE HERE.")
        end
 
LUA:
local config = {
	loginMessage = getConfigValue('loginMessage')
	}
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 
       		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "TYPE HERE.")
        end


Where in this do i put it?:

function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
 
Back
Top