• Did I do this ulx command correct?
    6 replies, posted
This is it: [CODE]local CATEGORY_NAME = "Info" local gamemode_error = "The current gamemode is not trouble in terrorist town" function GamemodeCheck(calling_ply) if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) return true else return false end end //beginning of functions function ulx.donate( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/donate")]]) for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has considered donating!" ) end end local donate = ulx.command( CATEGORY_NAME, "ulx donate", ulx.donate, "!donate" ) donate:addParam{ type=ULib.cmds.PlayersArg } donate:defaultAccess( ULib.ACCESS_USER ) donate:help( "Opens the Donate page of TGN" ) function ulx.admins( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/forums/m/10634491/viewthread/9595199-current-admins")]]) end local admins = ulx.command( CATEGORY_NAME, "ulx admins", ulx.admins, "!admins" ) admins:addParam{ type=ULib.cmds.PlayersArg } admins:defaultAccess( ULib.ACCESS_USER ) admins:help( "Shows a list of current Admins" ) function ulx.forums( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/forums/m/10634491/viewthread/9595199-current-admins")]]) end local forums = ulx.command( CATEGORY_NAME, "ulx forums", ulx.forums, "!forums" ) forums:defaultAccess( ULib.ACCESS_ALL ) forums:help( "Opens the TGN Forums" )[/CODE]
Why don't you use it...if it works you did it right.
i did use it, and it didn't work. but no worries my man, i just added them to menus.lua and its all fine now
Why dont you use the fancy log from ulx for saying stuff like "Xenomorph Lord has considered donating"? Also, I would recommend posting errors aswell if there are any. I just tested the code and got [code][ERROR] bad argument #1 to ULib.cmds.TranslateCommand:defaultAccess (string expected) 1. error - [C]:-1 2. checkArg - addons/ulib/lua/ulib/shared/misc.lua:520 3. defaultAccess - addons/ulib/lua/ulib/shared/commands.lua:1218 4. unknown - addons/ulx/lua/ulx/modules/sh/test.lua:22 5. include - [C]:-1 6. unknown - addons/ulx/lua/ulx/cl_init.lua:17 7. include - [C]:-1 8. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4 9. include - [C]:-1 10. unknown - addons/ulib/lua/ulib/cl_init.lua:23 11. include - [C]:-1 12. unknown - addons/ulib/lua/autorun/ulib_init.lua:5 [/code] Also why is there a player arg for donate and admins? Also your gamemode check doesn't work because I just tested this in sandbox and it worked. Here is a fix for the commands [lua]local CATEGORY_NAME = "Info" local gamemode_error = "The current gamemode is not trouble in terrorist town" function GamemodeCheck(calling_ply) if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) return true else return false end end //beginning of functions function ulx.donate( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/donate")]]) for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has considered donating!" ) end end local donate = ulx.command( CATEGORY_NAME, "ulx donate", ulx.donate, "!donate" ) donate:defaultAccess( ULib.ACCESS_ALL ) donate:help( "Opens the Donate page of TGN" ) function ulx.admins( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/forums/m/10634491/viewthread/9595199-current-admins")]]) end local admins = ulx.command( CATEGORY_NAME, "ulx admins", ulx.admins, "!admins" ) admins:defaultAccess( ULib.ACCESS_ALL ) admins:help( "Shows a list of current Admins" ) function ulx.forums( pl, text, teamonly ) pl:SendLua([[gui.OpenURL("http://tgngaming.info/forums/m/10634491/viewthread/9595199-current-admins")]]) end local forums = ulx.command( CATEGORY_NAME, "ulx forums", ulx.forums, "!forums" ) forums:defaultAccess( ULib.ACCESS_ALL ) forums:help( "Opens the TGN Forums" )[/lua] EDIT: Also, you should put the gamemode check in the functions themselves. That is how bender did it with his ulx commands.
Not to be rude but I did say I already fixed it, I dropped it in menus so they're now with the motd command and it works without any errors. And I don't know what the fancy log is but mine works, it just prints console chat. Oh and the player args were a mistake that I forgot to remove, they don't have them now.
[QUOTE=Wimoweh;42923493]Not to be rude but I did say I already fixed it, I dropped it in menus so they're now with the motd command and it works without any errors. And I don't know what the fancy log is but mine works, it just prints console chat. Oh and the player args were a mistake that I forgot to remove, they don't have them now.[/QUOTE] Ah my apologies. Remember to mark the thread as closed and close it :)
yeah sorry, I replied while in school and their wifi sucks, so my google chrome lost connection
Sorry, you need to Log In to post a reply to this thread.