General > Developers Corner
Adding a new custom xgui function
easer7:
I want to make a new command on the xGUI list, called DamageLog. I want it to be under utility. When you open it I want to have a button that says "Print DamageLog" and when you press it, the damage log appears. How it appears doesn't matter to me, whether in the console or in the GUI itself. Can someone help me out? It would really be appreciated =3
LuaTenshi:
--- Quote from: easer7 on November 28, 2012, 07:43:24 PM ---I want to make a new command on the xGUI list, called DamageLog. I want it to be under utility. When you open it I want to have a button that says "Print DamageLog" and when you press it, the damage log appears. How it appears doesn't matter to me, whether in the console or in the GUI itself. Can someone help me out? It would really be appreciated =3
--- End quote ---
Well the default command structure for ULX is some thing like this...
--- Code: ----- ULX spawn for ULX SVN/ULib SVN by HeLLFox_15
function ulx.spawn( calling_ply, target_plys, command )
for _, v in ipairs( target_plys ) do
if v:Alive() then v:KillSilent() else v:Spawn() end
v:Spawn()
end
ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys )
end
local spawn = ulx.command( CATEGORY_NAME, "ulx spawn", ulx.spawn, "!spawn" )
spawn:addParam{ type=ULib.cmds.PlayersArg }
spawn:defaultAccess( ULib.ACCESS_ADMIN )
spawn:help( "respawn a target(s)." )
--- End code ---
You can learn more about it here... http://ulyssesmod.net/docs/files/ULib_readme-txt.html
I would find you the specific pages you need but I cant seem to access the wiki from this computer... http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4875.html?title=Main_Page
Also always cross refrence with this site and make sure the information is still valid, http://wiki.garrysmod.com/page/Main_Page (That is the official Gmod 13 wiki, you may acctually find what your looking for there but if you cant use the Gmod 12 wiki and cross refrence.)
Happy coding, and sorry I could not have been more help... internet restrictions suck. :(
easer7:
Hey no worries! But once you can maybe you could help me out? (if you want)
easer7:
After the function part, what would I type? Because all I want it to do is print the DamageLog. The command is ttt_print_damagelog
LuaTenshi:
--- Quote from: easer7 on November 29, 2012, 02:48:59 PM ---After the function part, what would I type? Because all I want it to do is print the DamageLog. The command is ttt_print_damagelog
--- End quote ---
--- Code: ---function ulx.dlogs( calling_ply )
calling_ply:ConCommand("ttt_print_damagelog") -- This runs ttt_print_damagelog on the person who called the command (pressed the button or said !dlogs).
ulx.fancyLogAdmin( calling_ply, "#A is viewing the damage logs.", command, target_plys )
end
local dlogs= ulx.command( "Utility", "ulx dlogs", ulx.dlogs, "!dlogs" ) -- Makes the command be called dlogs and puts it in the Utility category.
dlogs:defaultAccess( ULib.ACCESS_ADMIN )
dlogs:help( "Shows the damage logs." )
--- End code ---
Try the above code I just through it together so you may want to look for mistakes and or clean it up a bit.
Navigation
[0] Message Index
[#] Next page
Go to full version