[GMOD & HAMMER] any way to run lua script?

hello there,
i asked in the maps section, but they only answered me that gmod blocks the “point_clientcommand” from hammer.

its accually pretty simple what i need…

there s an area in the map, if the player walks into it, takes the players X Y Z coords… then with lua i add 500 units to Z and port the player to the new given coords…

it does work with a concommand, when i type “move_to_top” ingame in console:


local trigger_up = Vector(0, 0, 768)
 
 
function move_to_top(player, commands, args)
    if player:IsAdmin() or player:IsSuperAdmin() then
            player:SetPos(player:GetPos() + trigger_up)
        end
end
            
concommand.Add("move_to_top", move_to_top)

but it wont let me trigger the concommand from hammer…
any ideas ?

thanks !
numu

There’s a brush-based entity in Garry’s Mod called ‘lua_run’. Here’s the source code for more detail on how it works. http://glua.me/bin/?path=/gamemodes/base/entities/entities/lua_run/init.lua

I’ve never used it personally, but I think all you need to do to get it working is pass a key ‘RunCode’ with the value being a single line of code.

that was it !
thanks!

/SOLVED