I’m making a little RP themed code that when a players name is entered, it says in chat that players RP information. (Basically just their money…)
First I struggled with figuring out how to send a message using lua and since I couldn’t remember the function, I just reverted to using RunConsoleCommand and running “say” with the additional args.
This is what I have so far.
// RP Dox V2 /* START MENU */ function rpdoxmenu() local manyoo = vgui.Create("DFrame") manyoo:SetSize(200,100) manyoo:MakePopup() manyoo:SetTitle("Entity Finder") manyoo:Center() -- manyoo:SetKeyBoardInputEnabled() (I guess you can't have the ability to walk while in menu if there is a text entry. Boo.) for k, v in pairs(player.GetAll()) do local playermoney = (v.DarkRPVars and v.DarkRPVars.money) or 0 local mark = ("(rpdox)") local Entroo = vgui.Create( "DTextEntry", manyoo ) Entroo:SetPos(manyoo:GetWide()/2-40,manyoo:GetTall()/2) Entroo:SetSize( 77, 20) Entroo.OnEnter = function() RunConsoleCommand("say", mark .. " PLAYERNAME: " .. v:Nick() .. ". STEAMID: " .. v:SteamID() .. ". PLAYERCASH: $" .. playermoney .. " (PLAYER IS STAFF) " .. mark) end end end concommand.Add("_rpdoxmenu", rpdoxmenu) /* END MENU */
I want to be able to TARGET players by typing in their name… I don’t exactly know how to do that.
Right know no matter what you type in, it chooses a random player and displays their info.