This is rather a stupid question but i will do it anyway
I lookt for tutorials on Garry's Mod wiki youtube ect but everytime as i type !servers in gamechat nothing happens no message in console. not even a error
[CODE]function chatcommand( ply, text, public)
if ( string.sub( string.lower( text ), 1, 8 ) == "!servers" ) then
ply:ConCommand("servers")
end
end
function servers()
local ply = LocalPlayer()
local DermaPanel = vgui.Create("DFrame")
hole dermapanel here a lot of code that i think is not needed
end
concommand.Add( "servers", servers)
hook.Add( "PlayerSay", "servers", servers )
[/CODE]
Serverside
[code]
function chatcommand( ply, text, public)
if ( string.StartWith(text,"!servers" ) ) then
ply:ConCommand("servers")
end
end
hook.Add( "PlayerSay", "chatcommand", chatcommand)[/code]
Clientside
[code]
function servers()
local ply = LocalPlayer()
local DermaPanel = vgui.Create("DFrame")
//hole dermapanel here a lot of code that i think is not needed
end
concommand.Add( "servers", servers)[/code]
ok ive put it now like that in my cl_init.lua gamemode murder if it makes a difference or not
console command works only the chat not.
i am really crappie at this.
[QUOTE=jordicod;43868146]ok ive put it now like that in my cl_init.lua gamemode murder if it makes a difference or not
console command works only the chat not.
i am really crappie at this.[/QUOTE]
If you're just doing it in cl_init do this
[code]
hook.Add("OnPlayerChat", "OnPlayerChat_Servers", function(ply, text)
if ply == LocalPlayer() and text == "!servers" then
local DermaPanel = vgui.Create("DFrame")
end
end)[/code]
Will try it in a few hours on work now but im sure it will work
doesnt work either if i !servers in chat nothing happens
Where is the file located?
C:\gmod-servers\Murder\garrysmod\gamemodes\murder\gamemode in the cl_init.lua
Sorry, you need to Log In to post a reply to this thread.