I don't quite know what ULX is/how it works, but in vanilla GMod you can make chat commands that link to websites like so:
[CODE]
hook.Add( 'OnPlayerChat', 'Unique_Name', function( ply, text, teamchat, dead ) -- change Unique_Name to some unique string
if text == "!website" then -- or whatever text you want
gui.OpenURL( 'somewebsite.com' ) -- open some website
return true -- return true to stop the message from being put in the chat, false if you want it to be put in the chat
end
end )
[/CODE]
Someone will probably post the proper way to do this in ULX though
In addons\ulx\lua\ulx\modules\sh\[I]namethis[/I].lua You can change [I]namethis [/I]to what you like
The namethis.lua should contain:
[code]
CATEGORY_NAME = "Community Links" -- What category this command falls under. Choose existing group or create a new one.
function ulx.steamgroup(ply)
ply:SendLua([[gui.OpenURL("http://YOURURLHERE.com/")]]) -- Opens URL on ply's browser.
end
local steamgroup = ulx.command( CATEGORY_NAME, "ulx steamgroup", ulx.steamgroup, "!steamgroup" ) -- "!steamgroup" is the custom command. Change this to whatever you want players to type in.
steamgroup:defaultAccess( ULib.ACCESS_ALL ) -- Who has access to this command? Refer to ULib ranks.
steamgroup:help( "Custom description here! CHANGE ME" ) -- Describes what the command does to the player using it.
[/code]
I put a little commentary in the code to assist you.
Warning: This is not my code and I have not tested this. In order to learn, try experimenting around with this code to fit your needs.
[QUOTE=fluffygods;49736345]In addons\ulx\lua\ulx\modules\sh\[I]namethis[/I].lua You can change [I]namethis [/I]to what you like
The namethis.lua should contain:
[code]
CATEGORY_NAME = "Community Links" -- What category this command falls under. Choose existing group or create a new one.
function ulx.steamgroup(ply)
ply:SendLua([[gui.OpenURL("http://YOURURLHERE.com/")]]) -- Opens URL on ply's browser.
end
local steamgroup = ulx.command( CATEGORY_NAME, "ulx steamgroup", ulx.steamgroup, "!steamgroup" ) -- "!steamgroup" is the custom command. Change this to whatever you want players to type in.
steamgroup:defaultAccess( ULib.ACCESS_ALL ) -- Who has access to this command? Refer to ULib ranks.
steamgroup:help( "Custom description here! CHANGE ME" ) -- Describes what the command does to the player using it.
[/code]
I put a little commentary in the code to assist you.
Warning: This is not my code and I have not tested this. In order to learn, try experimenting around with this code to fit your needs.[/QUOTE]
so if i wanted to add a donation command i would just change everything that says steamgroup to donation?
[QUOTE=broden1234;49739865]so if i wanted to add a donation command i would just change everything that says steamgroup to donation?[/QUOTE]
you dont deserve people donating to you if you have no idea how to do stuff
having a server and not being able to code for it is a bad idea
[QUOTE=thecubanpimp;49739981]you dont deserve people donating to you if you have no idea how to do stuff[/QUOTE]
I'll correct you.
You dont deserve people donating to you if you cant read a fking comment.
Example:
[CODE]
local steamgroup = ulx.command( CATEGORY_NAME, "ulx steamgroup", ulx.steamgroup, "!steamgroup" ) -- "!steamgroup" is the custom command. Change this to whatever you want players to type in.
[/CODE]
Obviously it was just a copy and paste into a lua file without actually reading anything.
Sorry, you need to Log In to post a reply to this thread.