Hi. I’m making a game mode and I don’t know how to do a few things in LUA.
I want to make a chat command such as !class_menu to execute a custom console command, which I already have made.
How Do I make it so maps starting with a certain name (such as “arena_map name”) automatically start my gamemode, which is an arena-type gamemode.
For the first question, Use **[Gamemode.PlayerSay
hook.Add( “PlayerSay”, “Execute Command”, function( ply, text, team, death )
if ply:IsPlayer() then
if string.lower(text) == “!class_menu” then
ply:ConCommand(“class_menu”) – Replace “class_menu” with your command.
And for the second question, I cant help you.
Thank you. Helps soo much
I believe you can use * as a wildcard eg. arena_*.bsp
Or you can use string.find().
You should be able to do that, yes.
for k, v in pairs (ents.FindByClass("npc_*")) do
You can set it more easily in the info.txt of the gamemode.
Example from the GMod wiki…