General > Developers Corner

How do I add !apply command?

(1/2) > >>

Risteh:
I want to make a command where you can type !apply and it opens a webpage in the Steam browser. I think I've got the code but I don't know where to put it.


--- Code: ---function ulx.apply( calling_ply )

calling_ply:SendLua([[gui.OpenURL( "]] .. GetConVarString("apply_url") .. [[" )]])

end

local apply = ulx.command( "Custom", "ulx apply", ulx.apply, "!apply" )
apply:defaultAccess( ULib.ACCESS_ALL )
apply:help( "Apply to staff team." )
--- End code ---

Mclovin:
addons/ulx/lua/modules/sh

JamminR:
better yet,  make your own addon.
Create folder in addons like
/addons/MyAddons/lua/ulx/modules/sh
Make an addon.txt file (use google or get syntax from another addon)
Make your apply.lua file in /addons/MyAddons/lua/ulx/modules/sh

Risteh:
When I put apply_url in console it says unknown command?

JamminR:
If you're using the same code you have listed in your original post, you'd have to use "ulx apply".
I'm thinking there might be other bugs too, but, lets start one at a time.
So, you've created two files, right?
/addons/MyAddons/addon.txt
/addons/MyAddons/lua/ulx/modules/sh/my_apply.lua
and in my_apply.lua, you've pasted your code from original post?

Navigation

[0] Message Index

[#] Next page

Go to full version