ULX

Author Topic: Ulib Name enforcer. Cant seem to fix.  (Read 2700 times)

0 Members and 1 Guest are viewing this topic.

Offline thetomm2010

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Ulib Name enforcer. Cant seem to fix.
« on: July 18, 2013, 10:53:53 PM »
So this is for and older version of Ulib forcing people to have the same name as when they first join the server. Not to sure what the "pluginEnabled" is suppose to be now and kinda just on my last limb. So any help would be great, I'm sure other people would like this too.
Code: [Select]
i f ULib.pluginEnabled() then
        ULib.addon = ULib.addon or {}
        local usernames = {}

        ULib.addon.forcename = function (iUserid, sNewname, sOldname)
                if not _PlayerInfo (iUserid, "connected") then
                        return false, "User is not connected"
                end
                local login, name = ULib.getSteamLogin (iUserid), _PlayerInfo (iUserid, "name")

                if not usernames[login] then
                        usernames[login] = name
                elseif sNewname ~= usernames[login] then
                        _PrintMessage (iUserid, HUD_PRINTTALK, "The server forced you to keep your name.")
                        AddTimer (0.1, 1, ULib.cexec, iUserid, "name " .. usernames[login])
                end
                return true
        end

        HookEvent ("eventPlayerInitialSpawn", ULib.addon.forcename)
else
        _Msg ("Plugin is not enabled\n")
end

here is the error

Quote
[ERROR] addons/ulib/lua/ulib/modules/nameforcer.lua:1: attempt to call field 'pluginEnabled' (a nil value)
  1. unknown - addons/ulib/lua/ulib/modules/nameforcer.lua:1
   2. include - [C]:-1
    3. unknown - addons/ulib/lua/ulib/cl_init.lua:23
     4. include - [C]:-1
      5. unknown - addons/ulib/lua/autorun/ulib_init.lua:5

 

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #1 on: July 19, 2013, 07:11:31 AM »
I believe it's pretty easy to fix this.

The first line, where it's supposed to say "if", it's saying "i f", there's a space between the 'I' and the 'F' that shouldn't be there, just remove that and save, and it should in theory work (correct me if I'm wrong, Lua pro's).
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline thetomm2010

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #2 on: July 19, 2013, 12:40:56 PM »
Not sure why the space is there but that is not suppose to be there. In the script that I use the i f is if. So unfortuately that is not it but thank you. I'm sure someone will know whats wrong tho hopefully lol.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #3 on: July 19, 2013, 03:37:52 PM »
This isn't for an older version of ULib.
This isn't for an older version of Gmod.
This is for an ancient version of both.

Just take the idea of it and re-write it.
Good Lua first learn project.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline thetomm2010

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #4 on: July 19, 2013, 03:51:03 PM »
Lmao alright thanks

Offline thetomm2010

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #5 on: July 19, 2013, 03:52:05 PM »
you can remove this thread if you want too. Ill make a new one with a new code.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #6 on: July 20, 2013, 12:04:46 PM »
Wow, it's been a long time since I've seen GM9 code. I don't remember much at all about it, except that this was before Garry figured out that not everything was possible from the server side.
Experiencing God's grace one day at a time.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #7 on: July 21, 2013, 01:30:35 AM »
That makes a lot more sense.

I didn't even look up where the code was from until now... 2006. Geez.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline thetomm2010

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: Ulib Name enforcer. Cant seem to fix.
« Reply #8 on: July 21, 2013, 12:23:43 PM »
Haha yeahh I wasn't playing this game at the time this came out so I'm just catching up with the times lol