• Print

Author Topic: Help With Command  (Read 10645 times)

0 Members and 1 Guest are viewing this topic.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Help With Command
« on: April 02, 2015, 07:10:23 am »
Hi Im New To Lua And Ive Got A Problem. Im Createing A Command That Permentley Bans Player, And Yes Pointless Command Because U Can Allredy Do A Ban For Infinate Amount Of Time

The Code Is:
Code: Lua
  1. local CATEGORY_NAME = "Livaco"
  2.  
  3. function ulx.banip( calling_ply, target_ply, reason )
  4.         if target_ply:IsBot() then
  5.                 Ulib.tsayError( calling_ply, "cannot ban a bot", false)
  6.                 return
  7.         end
  8.        
  9.         ULib.kickban( target_ply, reason, calling_ply )
  10.        
  11.         ulx.fancyLogAdmin( calling_ply, target_ply )
  12.        
  13. end
  14. local ban = ulx.command( CATEGORY_NAME, "ulx banip", ulx.banip, "!banip" )
  15. ban:addParam{  type=ULib.cmds.Playerarg }
  16. ban:addParam{ type=ULib.cmds.StringArg, hint="reason", Ulib.cmds.optional, ULib.cmds.takeResoOfLine, completes=ulx.common_kick_resons }
  17. ban:defultAccess{ ULib.ACCESS_ADMIN }
  18. ban:help{ "Permenentley Bans A Target" }
What Happens When I Use It: https://www.youtube.com/watch?v=ydDXaP30ddg

Thanks For Anay Help I Get
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 Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Help With Command
« Reply #1 on: April 02, 2015, 07:17:27 am »
You don't need to record yourself playing just to tell us it throws an error at you

The most helpful thing you could do is post your error so we know what to look for
Look in the console to copy the error

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Help With Command
« Reply #2 on: April 02, 2015, 07:36:30 am »
I Could Only Find 1
Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/livaco.lua:16: attempt to index global 'Ulib' (a nil value)
  1. unknown - addons/ulx/lua/ulx/modules/sh/livaco.lua:16
   2. include - [C]:-1
    3. unknown - addons/ulx/lua/ulx/cl_init.lua:17
     4. include - [C]:-1
      5. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4
       6. include - [C]:-1
        7. unknown - addons/ulib/lua/ulib/cl_init.lua:23
         8. include - [C]:-1
          9. unknown - addons/ulib/lua/autorun/ulib_init.lua:5
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 Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Help With Command
« Reply #3 on: April 02, 2015, 08:11:42 am »
Idk what your file looks like so idk which line is line 16, but I may have found the error
On line 5 of the code you posted here, it says Ulib but everywhere else it says ULib
Try changing that L to be capitalized then test it

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Help With Command
« Reply #4 on: April 02, 2015, 08:12:27 am »
Code: [Select]
ULib.cmds.takeResoOfLine
Fix your spelling mistake and it should work.

EDIT:  And what he said ^^^^

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Help With Command
« Reply #5 on: April 02, 2015, 08:45:29 am »
same results sorry
one other error I found thoh when I ran the command:
Code: [Select]
[ERROR] addons/ulx/lua/ulx/xgui/commands.lua:168: attempt to index field 'type' (a nil value)
  1. obj - addons/ulx/lua/ulx/xgui/commands.lua:168
   2. func - addons/ulx/lua/ulx/modules/cl/xlib.lua:1080
    3. animQueue_call - addons/ulx/lua/ulx/modules/cl/xlib.lua:1061
     4. func - addons/ulx/lua/ulx/modules/cl/xlib.lua:1080
      5. animQueue_call - addons/ulx/lua/ulx/modules/cl/xlib.lua:1061
       6. animQueue_start - addons/ulx/lua/ulx/modules/cl/xlib.lua:1048
        7. setselected - addons/ulx/lua/ulx/xgui/commands.lua:85
         8. OnRowSelected - addons/ulx/lua/ulx/xgui/commands.lua:305
          9. OnClickLine - lua/vgui/dlistview.lua:497
           10. unknown - lua/vgui/dlistview_line.lua:93

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 Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Help With Command
« Reply #6 on: April 02, 2015, 09:20:09 am »
Too many typos... Capitalization and proper spelling is key.
Code: [Select]
ULib.cmds.Playerarg

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Help With Command
« Reply #7 on: April 02, 2015, 09:27:19 am »
Capitalization and proper spelling is key.

Lua is EXTREMELY Case-Sensitive. One wrong letter and the entire script will break.
Once you get to know me, you'll find you'll have never met me at all.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Help With Command
« Reply #8 on: April 02, 2015, 11:04:05 am »
I changed the code:
Code: Lua
  1. local CATEGORY_NAME = "Livaco"
  2.  
  3. function ulx.banip( calling_ply, target_ply, reason )
  4.         if target_ply:IsBot() then
  5.                 ULib.tsayError( calling_ply, "Cannot ban a bot", false )
  6.                 return
  7.         end
  8.  
  9.         ULib.kickban( target_ply, reason, calling_ply )
  10.  
  11.         local str = "#A banedip #T "
  12.         if reason and reason ~= "" then str = str .. " (#s)" end
  13.         ulx.fancyLogAdmin( calling_ply, str, target_ply )
  14. end
  15. local ban = ulx.command( CATEGORY_NAME, "ulx ipban", ulx.ipban, "!ipban" )
  16. ban:addParam{ type=ULib.cmds.PlayerArg }
  17. ban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  18. ban:defaultAccess( ULib.ACCESS_ADMIN )
  19. ban:help( "Bans target Forever." )
And Now The Command Doesent Appear Atall
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 MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Help With Command
« Reply #9 on: April 02, 2015, 01:45:33 pm »
local ban = ulx.command( CATEGORY_NAME, "ulx ipban", ulx.ipban, "!ipban" )
function ulx.banip( calling_ply, target_ply, reason )


Please slow down and do this properly. All of these mistakes could have been easily avoided.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Help With Command
« Reply #10 on: April 02, 2015, 02:20:26 pm »
another eror *yawns*

Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/livaco.lua:17: attempt to call method 'defultAccess' (a nil value)
  1. unknown - addons/ulx/lua/ulx/modules/sh/livaco.lua:17
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 MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Help With Command
« Reply #11 on: April 02, 2015, 02:45:27 pm »
defaultAccess

Like I said. You need to start proofreading your code. These are all stupid easy mistakes that you could easily fix yourself. You're being lazy and expecting everyone else to essentially do this for you.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Help With Command
« Reply #12 on: April 02, 2015, 03:31:19 pm »
I only started learning yesterday and I'm a noob at Lua
Plus I'm trying to learn Lua and your calling me lazy when I'm asking for help about something I'm new to
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 MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Help With Command
« Reply #13 on: April 02, 2015, 03:39:18 pm »
There is a difference between being a noob and being lazy.
When the error tells you that defultAccess doesn't exist.. and instead of proofreading your code for spelling mistakes you come straight here and post the error hoping someone will just fix it for you is lazy. You will not learn that way.

Now.. on the flip side... if you do take time and look at it and still cant find the error, then by all means, ask for help. That's what we're here for. It's just that, you've posted typo after typo. Lua is easy in that it's english and easy to read. Check spelling and in lua capitalization makes a huge difference.

Also, as a tip, if you don't already use something like Notepad++ or Sublime to edit your lua code, I would highly recommend looking into one of them. I recommend Notepad++ for starting out but some people prefer Sublime as it has more features and better lua syntax highlighting.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Help With Command
« Reply #14 on: April 02, 2015, 05:23:42 pm »
I recommend Notepad++ for starting out but some people prefer Sublime as it has more features and better lua syntax highlighting.
As someone who used to use Notepad++ all the time, I would recommend Sublime Text over it anyday.

  • Print