• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Enter Gameworld [Global Message]

Synthetic_

deathzot.net
Joined
Dec 30, 2008
Messages
2,535
Reaction score
574
Well here's something simple that I thought would be cool to add to my server so I decided to release it here.
Tested on TFS0.3.5pl1
dcy29z.jpg


enter.lua
Lua:
function onLogin(cid)
 doBroadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: has entered the game world", MESSAGE_STATUS_CONSOLE_ORANGE)
return TRUE
end

leave.lua
Lua:
function onLogout(cid)
doBroadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: has left the game world", MESSAGE_STATUS_CONSOLE_ORANGE)
return TRUE
end

add this to creaturescripts.xml
Code:
<event type="login" name="enter" event="script" value="enter.lua"/>
<event type="logout" name="leave" event="script" value="leave.lua"/>

in login.lua add
Code:
registerCreatureEvent(cid, "enter")
 
You can do this in a single script:
Lua:
function onLogin(cid)
 doBroadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: has entered the game world", MESSAGE_STATUS_CONSOLE_ORANGE)
return TRUE
end

function onLogout(cid)
doBroadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: has left the game world", MESSAGE_STATUS_CONSOLE_ORANGE)
return TRUE
end

._."
 
Thx for the idea I used it for my server, but with Login/Logout channel. :)
 
You could do an extra channel where it is announced..

Btw. anyone knows how I can make a new channel and make it be opened all time? If you login it should be opened.
 
Can u make this but for Gm/God ..

Lua:
local str1 = " has just logged in."
local str2 = "Staff Position: "
local groups = {
    [2] = "Tutor",
    [3] = "Senior Tutor",
    [4] = "Gamemaster",
    [5] = "Community Manager",
    [6] = "Administrator"
}

function onLogin(cid)
    local name = getCreatureName(cid)
    for i, group in pairs(groups) do
        if(getPlayerGroupId(cid) == i) and (isPlayerGhost(cid) == false) then
            doBroadcastMessage(name .. str1, MESSAGE_STATUS_CONSOLE_RED)
            doBroadcastMessage(str2 .. group, MESSAGE_STATUS_CONSOLE_RED)
        end
        break
    end
    return true
end

  • 12:00 God has just logged in.
  • 12:00 Staff Position: Administrator.
 
lol... NO SPAM please!
Code:
[LEFT]  [COLOR=#B1B100]function[/COLOR] onLogin[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR]
 doBroadcastMessage[COLOR=#66CC66]([/COLOR]getPlayerName[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR] .. [COLOR=#FF0000]" ["[/COLOR] .. getPlayerLevel[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR] .. [COLOR=#FF0000]"]: has entered the game world"[/COLOR], MESSAGE_STATUS_SMALL[COLOR=#66CC66])[/COLOR]
 [COLOR=#B1B100]return[/COLOR] TRUE
 [COLOR=#B1B100]end[/COLOR]
 
 [COLOR=#B1B100]function[/COLOR] onLogout[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR]
doBroadcastMessage[COLOR=#66CC66]([/COLOR]getPlayerName[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR] .. [COLOR=#FF0000]" ["[/COLOR] .. getPlayerLevel[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66])[/COLOR] .. [COLOR=#FF0000]"]: has left the game world"[/COLOR], MESSAGE_STATUS_SMALL[COLOR=#66CC66])[/COLOR]
 [COLOR=#B1B100]return[/COLOR] TRUE
 [COLOR=#B1B100]end[/COLOR]  [/LEFT]
 
Please Make this only for Gods,Tutors,Game Masters, And CM's. im waiting for this
 
Back
Top