• Print via Server
    8 replies, posted
I know I've been creating a lot of topics, and if I have one more question, I'll just start a topic where I can ask everything. Anyway, I want to be able to echo/print something to an admin's console via a server script. If I can't do this, how would I go about doing it?
[lua] function PrintToAdmins(txt) for k, ply in pairs(player.GetAll())do if ply:IsAdmin() then ply:ChatPrint(txt) end end end [/lua]
Thanks, but I don't want a chat print, I want to print to their console only.
[QUOTE=Banana Lord.;25210176]Thanks, but I don't want a chat print, I want to print to their console only.[/QUOTE] Oh sorry, wait [lua] function PrintToAdmins(txt) for k, ply in pairs(player.GetAll())do if ply:IsAdmin() then ply:PrintMessage(HUD_PRINTCONSOLE,txt) end end end [/lua] or something like that. :buddy:
this may be what you want. NOTE: the text size can only be 255 bytes max [lua] AddCSLuaFile(" this script name .lua") if SERVER then function ConsolePrint(admin, text) umsg.Start( "admin_print", admin ) umsg.String(text) umsg.End() end end if CLIENT then usermessage.Hook( "admin_print", function( um ) local str = um:ReadString() Msg(str) end) end [/lua]
ZpankR's code does the same thing pretty much.
I'd rather not run into limits, but I had a feeling you could do it with UMsgs. Thank you all very much!
[QUOTE=blackops7799;25210544]ZpankR's code does the same thing pretty much.[/QUOTE] yhea :(
[QUOTE=TGiFallen;25210859]yhea :([/QUOTE] its ok i still love everyone here :) [editline]08:45PM[/editline] [lua]function PrintToAdmins( message ) for k,v in pairs(player.GetAll())do if v:IsAdmin() or v:IsSuperAdmin() then v:PrintMessage(HUD_PRINTCONSOLE, message) end end end PrintToAdmins("HELLLO!")[/lua] in test.lua, doesn't do anything. doing the following does [lua]for k,v in pairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCONSOLE, "HELLO!") end[/lua] no errors in the function... [editline]08:47PM[/editline] Wait im retarded nvm
Sorry, you need to Log In to post a reply to this thread.