• know when staff has joined server
    31 replies, posted
so ive been in a couple servers that when an admin or help or owner has entered the server it says their staff name beside their steam name also when they talk it shows up. so i was wondering which lua file would have to be edited to do this. im not asking for the lua coding for it i was just wanted someone to steer me in the right direction to do this.
Google search 'chat tags' if that's what you mean.
make your own lua file in lua/autorun or you can use the free addon [URL="http://forums.ulyssesmod.net/index.php?topic=6036.0"]here[/URL] and just add an IsAdmin() check
[QUOTE=_Jacob;44042525]make your own lua file in lua/autorun or you can use the free addon [URL="http://forums.ulyssesmod.net/index.php?topic=6036.0"]here[/URL] and just add an IsAdmin() check[/QUOTE] awesome! ill give it a try. thank you so much for your help! [editline]25th February 2014[/editline] ok so this what ive got and i want it so that it says the admins name beside their name when they join [lua] if CLIENT then local function Chat(um) local ply = um:ReadString() local mode = um:ReadString() local id = um:ReadString() if mode == "1" then chat.AddText(Color(186, 117, 255),"(Server) ",Color(41,91,255),ply,Color(0, 0, 0)," is",Color(255, 237, 97)," joining ",Color(0, 0, 0),"the server!") end end usermessage.Hook("DispatchChatJoin", Chat) end local function PlyJoined( name ) if SERVER then for k,v in pairs(player.GetAll()) do SendUserMessage("DispatchChatJoin", v, name, "1") end end end hook.Add( "PlayerConnect", "PlyJoined", PlyJoined ) [/lua] [editline]25th February 2014[/editline] i think i need to add this but i dont know where [lua] if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end [/lua]
Do you want it to only say something if a staff joins?
-snip- Put that in a shared file. I even wrote instructions for it. There's no reason for it to not work though I don't have time to test it.
[QUOTE=Kevin;44044254]Do you want it to only say something if a staff joins?[/QUOTE] yes [editline]25th February 2014[/editline] [QUOTE=Mors Quaedam;44044308][code]-- if you use ulx then just add your additional -- usergroups below the ones that are in the -- ranks table. you can also edit the existing -- entries but don't remove them otherwise -- the script won't work. if you don't use ulx -- this should still work. it's untested. if SERVER then util.AddNetworkString("colouredjoinmsg") local ranks = { "superadmin" = { -- don't remove this one. Color = Color(255,0,0), Title = "Super Admin" }, "admin" = { -- don't remove this one Color = Color(0,0,255), Title = "Super Admin" }, "user" = { -- don't remove this one Color = Color(0,128,255), Title = "Super Admin" } } hook.Add( "PlayerInitialSpawn", "Welcome", function(ply) local rank = "Player" local color = Color(0,128,255) if ucl then if ranks[ply:GetUserGroup()] then rank = ranks[ply:GetUserGroup()].Title color = ranks[ply:GetUserGroup()].Color else rank = "Unknown Rank" color = Color(255,255,255) end else if ply:IsSuperAdmin() then rank = ranks["superadmin"].Title color = ranks["superadmin"].Color elseif ply:IsAdmin() then rank = ranks["admin"].Title color = ranks["admin"].Color else rank = ranks["user"].Title color = ranks["user"].Color end end net.Start("colouredjoinmsg") net.WriteString(ply:Nick()) net.WriteString(rank) net.WriteTable(color) net.Broadcast() end) end if CLIENT then net.Receive("colouredjoinmsg", function(len) local name = net.ReadString() local rank = net.ReadString() local color = net.ReadTable() chat.AddText(color,nick,Color(255,255,255)," has spawned in the server with the rank ",color,rank,Color(255,255,255),".") end) end[/code] Put that in a shared file. I even wrote instructions for it. There's no reason for it to not work though I don't have time to test it.[/QUOTE] awesome! thank you! ill test it now
I edited it... all the ranks have the title "Super Admin" so you may want to change that.
[QUOTE=Mors Quaedam;44044375]I edited it... all the ranks have the title "Super Admin" so you may want to change that.[/QUOTE] got too many lua erros it said at line 11
Can you post the full error from your server and/or client please?
[QUOTE=Mors Quaedam;44044447]Can you post the full error from your server and/or client please?[/QUOTE] [ERROR] addons/con anddis/lua/autorun/(dis)connect.lua:11: unexpected symbol nea r '=' 1. unknown - addons/con anddis/lua/autorun/(dis)connect.lua:0
Oh I know what I did wrong... I should have it fixed in a bit. [editline]25th February 2014[/editline] [code]-- if you use ulx then just add your additional -- usergroups below the ones that are in the -- ranks table. you can also edit the existing -- entries but don't remove them otherwise -- the script won't work. if you don't use ulx -- this should still work. it's untested. if SERVER then util.AddNetworkString("colouredjoinmsg") AddCSLuaFile() local ranks = {} function AddExtraRank(id,title,col) ranks[id] = {} ranks[id].Title = title ranks[id].Color = col MsgC(Color(0,255,0),"\tAdded an extra rank to the join script ("..id..", "..title..")\n") end AddExtraRank("superadmin","Super Admin",Color(255,0,0)) AddExtraRank("admin","Admin",Color(0,0,255)) AddExtraRank("user","Player",Color(0,128,255)) -- don't remove these three. just add more as necessary. hook.Add( "PlayerInitialSpawn", "Welcome", function(ply) local rank = "Player" local color = Color(0,128,255) if ucl then if ranks[ply:GetUserGroup()] then rank = ranks[ply:GetUserGroup()].Title color = ranks[ply:GetUserGroup()].Color else rank = "Unknown Rank" color = Color(255,255,255) end else if ply:IsSuperAdmin() then rank = ranks["superadmin"].Title color = ranks["superadmin"].Color elseif ply:IsAdmin() then rank = ranks["admin"].Title color = ranks["admin"].Color else rank = ranks["user"].Title color = ranks["user"].Color end end net.Start("colouredjoinmsg") net.WriteString(ply:Nick()) net.WriteString(rank) net.WriteTable(color) net.Broadcast() end) end if CLIENT then net.Receive("colouredjoinmsg", function(len) local name = net.ReadString() local rank = net.ReadString() local color = net.ReadTable() chat.AddText(color,nick,Color(255,255,255)," has spawned in the server with the rank ",color,rank,Color(255,255,255),".") end) end[/code] Sorry - I'm not really concentrating... this code should work.
[QUOTE=Mors Quaedam;44044494]Oh I know what I did wrong... I should have it fixed in a bit. [editline]25th February 2014[/editline] [code]-- if you use ulx then just add your additional -- usergroups below the ones that are in the -- ranks table. you can also edit the existing -- entries but don't remove them otherwise -- the script won't work. if you don't use ulx -- this should still work. it's untested. if SERVER then util.AddNetworkString("colouredjoinmsg") AddCSLuaFile() local ranks = {} function AddExtraRank(id,title,col) ranks[id] = {} ranks[id].Title = title ranks[id].Color = col MsgC(Color(0,255,0),"\tAdded an extra rank to the join script ("..id..", "..title..")\n") end AddExtraRank("superadmin","Super Admin",Color(255,0,0)) AddExtraRank("admin","Admin",Color(0,0,255)) AddExtraRank("user","Player",Color(0,128,255)) -- don't remove these three. just add more as necessary. hook.Add( "PlayerInitialSpawn", "Welcome", function(ply) local rank = "Player" local color = Color(0,128,255) if ucl then if ranks[ply:GetUserGroup()] then rank = ranks[ply:GetUserGroup()].Title color = ranks[ply:GetUserGroup()].Color else rank = "Unknown Rank" color = Color(255,255,255) end else if ply:IsSuperAdmin() then rank = ranks["superadmin"].Title color = ranks["superadmin"].Color elseif ply:IsAdmin() then rank = ranks["admin"].Title color = ranks["admin"].Color else rank = ranks["user"].Title color = ranks["user"].Color end end net.Start("colouredjoinmsg") net.WriteString(ply:Nick()) net.WriteString(rank) net.WriteTable(color) net.Broadcast() end) end if CLIENT then net.Receive("colouredjoinmsg", function(len) local name = net.ReadString() local rank = net.ReadString() local color = net.ReadTable() chat.AddText(color,nick,Color(255,255,255)," has spawned in the server with the rank ",color,rank,Color(255,255,255),".") end) end[/code] Sorry - I'm not really concentrating... this code should work.[/QUOTE] hey thank again for your help but its saying this now [ERROR] addons/con anddis/lua/autorun/(dis)connect.lua:18: unexpected symbol nea r '=' 1. unknown - addons/con anddis/lua/autorun/(dis)connect.lua:0 i notice the end part was in the wrong spot so i fixed and still got the same thing [editline]25th February 2014[/editline] [QUOTE=jobforacowboy;44044627]hey thank again for your help but its saying this now [ERROR] addons/con anddis/lua/autorun/(dis)connect.lua:18: unexpected symbol nea r '=' 1. unknown - addons/con anddis/lua/autorun/(dis)connect.lua:0 i notice the end part was in the wrong spot so i fixed and still got the same thing[/QUOTE] im sorry my mistake its working great!!i didnt notice u corrected it. thaank again for all your help!
-snip- He fixed it!
[QUOTE=Acecool;44044735]-snip- He fixed it![/QUOTE] yeah he was fast i didnt notice it the first time
The [code] tags broke and put ="keyword"> into the code... nothing I can do about that.
[QUOTE=Mors Quaedam;44044772]The [code] tags broke and put ="keyword"> into the code... nothing I can do about that.[/QUOTE] no worries, thank again! your the man! [editline]25th February 2014[/editline] so this code works great but i just wanted to add one thing. so when someone joins the server i want it to say superadmin(name) has spawn into the server. ive added the print("("..id..")") to line 60 but i cant get it to work heres the code [lua] -- if you use ulx then just add your additional -- usergroups below the ones that are in the -- ranks table. you can also edit the existing -- entries but don't remove them otherwise -- the script won't work. if you don't use ulx -- this should still work. it's untested. if SERVER then util.AddNetworkString("colouredjoinmsg") AddCSLuaFile() local ranks = {} function AddExtraRank(id,title,col) ranks[id] = {} ranks[id].Title = title ranks[id].Color = col MsgC(Color(0,255,0),"\tAdded an extra rank to the join script ("..id..", "..title..")\n") end AddExtraRank("superadmin","Super Admin",Color(255,0,0)) AddExtraRank("admin","Admin",Color(0,0,255)) AddExtraRank("user","Player",Color(0,128,255)) -- don't remove these three. just add more as necessary. hook.Add( "PlayerInitialSpawn", "Welcome", function(ply) local rank = "Player" local color = Color(0,128,255) if ucl then if ranks[ply:GetUserGroup()] then rank = ranks[ply:GetUserGroup()].Title color = ranks[ply:GetUserGroup()].Color else rank = "Unknown Rank" color = Color(255,255,255) end else if ply:IsSuperAdmin() then rank = ranks["superadmin"].Title color = ranks["superadmin"].Color elseif ply:IsAdmin() then rank = ranks["admin"].Title color = ranks["admin"].Color else rank = ranks["user"].Title color = ranks["user"].Color end end net.Start("colouredjoinmsg") net.WriteString(ply:Nick()) net.WriteString(rank) net.WriteTable(color) net.Broadcast() end) end if CLIENT then net.Receive("colouredjoinmsg", function(len) local name = net.ReadString() local rank = net.ReadString() local color = net.ReadTable() chat.AddText(color,rank,print("("..id..")"),Color(255,255,255)," has spawn into the server ",color,nick,Color(255,255,255),".") end) end [/lua]
would i use print to display the name?
Depends on what you want to do, add it to chat or add it to console. Console, then yes use print. Chat, then no, use chat.AddText( [ Color, text ]+ )
[QUOTE=Acecool;44047856]Depends on what you want to do, add it to chat or add it to console. Console, then yes use print. Chat, then no, use chat.AddText( [ Color, text ]+ )[/QUOTE] when someone joins the it says "player has spawn into the server" in the chat.i want it to say "player(steamname) has spawn into the server".
Well you changed my original code... and player(steamname) is an ugly way to display something in the chat box. This looks far better: [img]http://puu.sh/7aA1s/8d17bdc861.jpg[/img]
[QUOTE=Mors Quaedam;44047962]Well you changed my original code... and player(steamname) is an ugly way to display something in the chat box. This looks far better: [img]http://puu.sh/7aA1s/8d17bdc861.jpg[/img][/QUOTE] yeah i changed a couple things around becuase i was trying to figure it out
Well just use the code I posted here: [url]http://facepunch.com/showthread.php?t=1369204&p=44044494&viewfull=1#post44044494[/url]
i know i am using it but i just wanted to add the persons steam name to it [editline]26th February 2014[/editline] sorry im so new to this and ive been trying all day to get this my apologizes
It prints their steam name.... this code: [code]chat.AddText(color,nick,Color(255,255,255)," has spawned in the server with the rank ",color,rank,Color(255,255,255),".")[/code] in the chat: [B][highlight]Mors Quaedam[/highlight] has spawned in the server with the rank [highlight]Super Admin[/highlight].[/B]
[QUOTE=Mors Quaedam;44048083]It prints their steam name.... this code: [code]chat.AddText(color,nick,Color(255,255,255)," has spawned in the server with the rank ",color,rank,Color(255,255,255),".")[/code] in the chat: [B][highlight]Mors Quaedam[/highlight] has spawned in the server with the rank [highlight]Super Admin[/highlight].[/B][/QUOTE] it only comes up as this "has spawned in the server with rank super admin" and display the steam name
[QUOTE=jobforacowboy;44048137][U]it only comes up as[/U] this "has spawned in the server with rank super admin" [U]and display the steam name[/U][/QUOTE] You need to speak proper English with me otherwise I struggle to understand what you're on about. Are you saying it says: [B] has spawned in the server with the rank [highlight]Super Admin[/highlight].[/B]?
[QUOTE=Mors Quaedam;44048174]You need to speak proper English with me otherwise I struggle to understand what you're on about. Are you saying it says: [B] has spawned in the server with the rank [highlight]Super Admin[/highlight].[/B]?[/QUOTE] yes
Well I can't find any blatant issues in my code, unless anyone else can?
its ok dont worry about it, im sure its something im doing wrong. thanx again for your help
Sorry, you need to Log In to post a reply to this thread.