Hello,
I wanted to let my vgui open when a user writes !help in the chat
I juts googled now for 2 hours and just got this result:
hook.Add( "PlayerSay", "Chatcmd", function(ply, text, pblc)
ifstring.lower(text) == "!help" then
local frame=vgui.Create("DFrame")
frame:SetSize(500,300)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(false)
frame:SetTitle("")
frame.Paint = function(s,w,h)
draw.RoundedBox(0,0,0,w ,h,Color(40,40,40)) --INNEN
draw.RoundedBox(0,0,0,w,25,Color(20,20,20))
end
It still dont work I need your help pls.
There is more code but I dont think I have all the code into the hook. Am I right?
thx for help.
if SERVER then
util.AddNetworkString("GuiHelp")
hook.Add( "PlayerSay", "Chatcmd", function(ply, text, pblc)
if string.lower(text) == "!help" then
net.Start("GuiHelp")
net.Send(ply)
end
end)
end
if CLIENT then
net.Recive("GuiHelp",function()
local frame=vgui.Create("DFrame")
frame:SetSize(500,300)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(false)
frame:SetTitle("")
frame.Paint = function(s,w,h)
draw.RoundedBox(0,0,0,w ,h,Color(40,40,40)) --INNEN
draw.RoundedBox(0,0,0,w,25,Color(20,20,20))
end
end)
end
This is client side i guess?
Server-Side:
hook.Add("PlayerSay","Rtd", function (ply,message,public)
if !IsValid(ply) then return end
mes = string.lower( message )
if mes == "/help" or mes == "!help" then
ply:ConCommand( "guihelp" )
end
end )
Client-Side:
concommand.Add( "guihelp", function()
local frame=vgui.Create("DFrame")
frame:SetSize(500,300)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(false)
frame:SetTitle("")
frame.Paint = function(s,w,h)
draw.RoundedBox(0,0,0,w ,h,Color(40,40,40)) --INNEN
draw.RoundedBox(0,0,0,w,25,Color(20,20,20))
end
end)
Thanks for your reply!
I just did it like this:
AddCSLuaFile("sptuser.lua") --userfile
include("sptserver.lua") --server file
surface.CreateFont( "LabelFont1", {
font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "TextFont", {
font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 15,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
concommand.Add( "guihelp", function()
local frame=vgui.Create("DFrame")
frame:SetSize(500,300)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(false)
frame:SetTitle("")
frame.Paint = function(s,w,h)
draw.RoundedBox(0,0,0,w ,h,Color(40,40,40)) --INNEN
draw.RoundedBox(0,0,0,w,25,Color(20,20,20))
end
https://files.facepunch.com/forum/upload/309258/b8619cfc-f0d7-471b-a395-caf71654e5f5/Screenshot_36.png
https://files.facepunch.com/forum/upload/309258/59ce51c0-9318-4d00-990c-692a45033011/Screenshot_35.png
https://files.facepunch.com/forum/upload/309258/2b389c01-8993-47a9-ac64-3c7451b26a2a/Screenshot_34.png
https://files.facepunch.com/forum/upload/309258/5e46b1d2-a9f3-4907-8e97-2b7d8430d0ca/Screenshot_37.png
I know the error msg has nothing to do with the actual problem, but I'm also looking for a 1 hour for a solution for it. I'm also not sure if I did that correctly with the include and the folders.
This is so hard :/
If you can help me agian it would be really nice ur would be my life saver!!!
Sorry, you need to Log In to post a reply to this thread.