• Print

Author Topic: Command not wqorking  (Read 5721 times)

0 Members and 1 Guest are viewing this topic.

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Command not wqorking
« on: April 11, 2015, 01:35:20 pm »
So Im redoing my command since for some reason it got deleted but the command is not working. I do not know what is wrong with it right now
Code: Lua
  1. CATEGORY_NAME = "BDG Commands"
  2.  
  3. function ulx.hopper()
  4.         if SERVER then
  5.             util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
  6.         end
  7.          
  8.         if CLIENT then
  9.             net.Receive("cl_openserverhoppermenu",
  10.             function (ply)
  11.                 RunConsoleCommand("serverhopping")
  12.             end)
  13.         end
  14.          
  15.         function ulx.hopper(calling_ply)
  16.             net.Start("cl_openserverhoppermenu")
  17.             net.Send(calling_ply)
  18.         end
  19. end
  20. local hopper = ulx.command( CATEGORY_NAME, "ulx hopper", ulx.hopper, "!servers", "hop" )
  21. hopper:defaultAccess( ULib.ACCESS_ALL )
  22. hopper:help( "Switch between our servers" )
  23.  
Newb Coder. Soon to get better

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Command not wqorking
« Reply #1 on: April 11, 2015, 04:59:20 pm »
What's it supposed to be doing and what doesn't it do?

Offline Zoeo

  • Newbie
  • *
  • Posts: 15
  • Karma: 1
Re: Command not wqorking
« Reply #2 on: April 11, 2015, 05:13:06 pm »
What's it supposed to be doing and what doesn't it do?
I think this is a server hopper that will allow you to switch servers using a menu? Not sure but he can correct me.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Command not wqorking
« Reply #3 on: April 11, 2015, 10:03:50 pm »
Why do you have two ulx.hopper functions?  That is your entire problem.  Fix that and it should work.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Command not wqorking
« Reply #4 on: April 11, 2015, 10:36:02 pm »
Why do you have two ulx.hopper functions?  That is your entire problem.  Fix that and it should work.

Good catch. Functions in lua are first class, so by defining the function inside the function, you're essentially overriding it and it won't work.

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Command not wqorking
« Reply #5 on: April 12, 2015, 06:41:18 am »
Im am probably the most blind person on this planet. Thanks Guys
Newb Coder. Soon to get better

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Command not wqorking
« Reply #6 on: April 12, 2015, 06:48:05 am »
AGH! Still not working
Code: Lua
  1. CATEGORY_NAME = "BDG Commands"
  2. if SERVER then
  3.     util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
  4. end
  5.  
  6. if CLIENT then
  7.     net.Receive("cl_openserverhoppermenu",
  8.     function (ply)
  9.         RunConsoleCommand("serverhopping")
  10.     end)
  11. end
  12.  
  13. function ulx.hopper(calling_ply)
  14.     net.Start("cl_openserverhoppermenu")
  15.     net.Send(calling_ply)
  16. end
  17. local hopper = ulx.command( CATEGORY_NAME, "ulx hopper", ulx.hopper, "!servers", "hop" )
  18. hopper:defaultAccess( ULib.ACCESS_ALL )
  19. hopper:help( "Switch between our servers" )
Newb Coder. Soon to get better

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Command not wqorking
« Reply #7 on: April 12, 2015, 09:46:28 am »
Put The Funtian Above If Server
Example

Now
Code: [Select]
CATEGORY_NAME = "BDG Commands"
if SERVER then
    util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
end
 
if CLIENT then
    net.Receive("cl_openserverhoppermenu",
    function (ply)
        RunConsoleCommand("serverhopping")
    end)
end
 
function ulx.hopper(calling_ply)
    net.Start("cl_openserverhoppermenu")
    net.Send(calling_ply)
end

Correct
Code: [Select]
function ulx.hopper(calling_ply)
    net.Start("cl_openserverhoppermenu")
    net.Send(calling_ply)
end
if SERVER then
    util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
end
 
if CLIENT then
    net.Receive("cl_openserverhoppermenu",
    function (ply)
        RunConsoleCommand("serverhopping")
    end)
end

Thats What It Would Be I Think
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Command not wqorking
« Reply #8 on: April 12, 2015, 10:03:43 am »
Put The Funtian Above If Server
Example

Now
Code: [Select]
CATEGORY_NAME = "BDG Commands"
if SERVER then
    util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
end
 
if CLIENT then
    net.Receive("cl_openserverhoppermenu",
    function (ply)
        RunConsoleCommand("serverhopping")
    end)
end
 
function ulx.hopper(calling_ply)
    net.Start("cl_openserverhoppermenu")
    net.Send(calling_ply)
end

Correct
Code: [Select]
function ulx.hopper(calling_ply)
    net.Start("cl_openserverhoppermenu")
    net.Send(calling_ply)
end
if SERVER then
    util.AddNetworkString("cl_openserverhoppermenu") -- long name to prevent conflicts
end
 
if CLIENT then
    net.Receive("cl_openserverhoppermenu",
    function (ply)
        RunConsoleCommand("serverhopping")
    end)
end

Thats What It Would Be I Think
Nope, still
Code: Lua
  1. [ERROR] addons/ulx/lua/ulx/modules/sh/bdg.lua:16: bad argument #4 to ULib.cmds.TranslateCommand (nil,boolean expected, got string)
  2.   1. error - [C]:-1
  3.    2. checkArg - addons/ulib/lua/ulib/shared/misc.lua:520
  4.     3. instantiate - addons/ulib/lua/ulib/shared/commands.lua:1083
  5.      4. ulxCommand - addons/ulib/lua/ulib/shared/misc.lua:843
  6.       5. command - addons/ulx/lua/ulx/sh_base.lua:43
  7.        6. unknown - addons/ulx/lua/ulx/modules/sh/bdg.lua:16
  8.         7. include - [C]:-1
  9.          8. unknown - addons/ulx/lua/ulx/cl_init.lua:17
  10.           9. include - [C]:-1
  11.            10. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4
  12.             11. include - [C]:-1
  13.              12. unknown - addons/ulib/lua/ulib/cl_init.lua:23
  14.               13. include - [C]:-1
  15.                14. unknown - addons/ulib/lua/autorun/ulib_init.lua:5
  16.  
Newb Coder. Soon to get better

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Command not wqorking
« Reply #9 on: April 12, 2015, 10:53:46 am »
NVM. Fixed it though it is not for everyone unless I didnt check my code again
Newb Coder. Soon to get better

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Command not wqorking
« Reply #10 on: April 12, 2015, 10:06:48 pm »
Put The Funtian Above If Server

-snip-

Thats What It Would Be I Think

Just so you're aware, that does nothing to the code.  It will still run the same.


And it appears you fixed the code, but if you didn't, the last argument in your ulx.command line is invalid.  That needs to be a boolean for hiding chat.

  • Print