• 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 Alert on GM Login

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
I duno, i was bored so..

idea + bad checking variable code: Chris77
sexy code: Old Greg

What the script does is based on your GroupID it broadcasts when a Staff Memeber logs in.

Code:
function onLogin(cid)
      if getPlayerGroupId(cid) == 2 then
      BroadcastMessage(getCreatureName(cid) .. " Has now logged in. Position: Tutor",22)
      elseif getPlayerGroupId(cid) == 3 then
      BroadcastMessage(getCreatureName(cid) .. " Has now logged in. Position: Sr. Tutor",22)
      elseif getPlayerGroupId(cid) == 4 then
      BroadcastMessage(getCreatureName(cid) .. " Has now logged in. Position: GM",22)
      elseif getPlayerGroupId(cid) == 5 then
      BroadcastMessage(getCreatureName(cid) .. " Has now logged in. Position: CM",22)
      elseif getPlayerGroupId(cid) == 6 then
      BroadcastMessage(getCreatureName(cid) .. " Has now logged in. Position: God",22)
      end
         end
 
Last edited:
:)
Code:
local str = "has now logged in. Position:"
local groups =
{
    [2] = "Tutor",
    [3] = "Senior Tutor",
    [4] = "GM",
    [5] = "Community Manager",
    [6] = "God"
}

function onLogin(cid)
    local name = getCreatureName(cid)
    for i, group in pairs(groups) do
        if(getPlayerGroupId(cid) == i) then
            doBroadcastMessage(name .. str .. group, MESSAGE_EVENT_ADVANCE)
        end
        break
    end
    return true
end
 
Good revision, I didn't want to spend much time on writing it, both get the job done. :) yours is more efficient though
 
A bit shortened (Works only for 0.3+ :D)

Code:
function onLogin(cid)
	local group = getPlayerGroupId(cid)
	if(group >= 2 and isPlayerGhost(cid) ~= TRUE) then
		doBroadcastMessage(getCreatureName(cid) .. " has now logged in (Position: " .. getGroupInfo(group).name .. ")", MESSAGE_EVENT_ADVANCE)
	end
	return TRUE
end

#Edit
Added checking for ghost mode.. so it won't be broadcasted if GM is in ghost
 
Last edited:
Haha, nice. Didn't see that function "getGroupInfo" woulda saved some typing.
 
great idea but the some gms tend to relog a lot which is spam so could u make a 10 minute exhaust on it?
 
Improved...

Lua:
local groups =
{
    [2] = "Tutor",
    [3] = "Senior Tutor",
    [4] = "GM",
    [5] = "Community Manager",
    [6] = "God"
}

function onLogin(cid)
	if(groups[getPlayerGroupId(cid)] and isPlayerGhost(cid) ~= TRUE) then
		doBroadcastMessage(getCreatureName(cid) .. " has now logged in. Position: " .. getGroupInfo(groups[getPlayerGroupId(cid)]).name .. ")")
		return TRUE
	end
	return TRUE
end
 
Improved...

Lua:
local groups =
{
    [2] = "Tutor",
    [3] = "Senior Tutor",
    [4] = "GM",
    [5] = "Community Manager",
    [6] = "God"
}

function onLogin(cid)
	if(groups[getPlayerGroupId(cid)] and isPlayerGhost(cid) ~= TRUE) then
		doBroadcastMessage(getCreatureName(cid) .. " has now logged in. Position: " .. getGroupInfo(groups[getPlayerGroupId(cid)]).name .. ")")
		return TRUE
	end
	return TRUE
end

it won't work :p (getGroupInfo)
 
Lol GODs / GMs, maybe aren't going to use it, they get always PM spammed asking "free items" "send me here" "send me there" "come plx" "X killed me" "kill Y" etc etc. So if they got a notification that a GOD / GM logged in, that'll be they're death xD
 
Here you go bud, Add this to ur creaturescripts.xml

Code:
<event type="login" name="StaffLogin" script="StaffLogin.lua"/>
 
Edited

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) ~= TRUE then
            doBroadcastMessage(name .. str1, MESSAGE_STATUS_CONSOLE_RED)
	    doBroadcastMessage(str2 .. group, MESSAGE_STATUS_CONSOLE_RED)
        end
        break
    end
    return TRUE
end

17:05 Admin Thor has just logged in.
17:05 Staff Position: Administrator
 
Last edited:
So it would look like the message...
 
@chris :p

yeh, same thing like the guy up. when u login it won't let u in game, automatically logs you out :p

Tfs cryingdamson4pI2

:s

Cheers..
 
Which of these scripts are you using cause many people have posted updated and *Cleaner* scripts.
 
Back
Top