Ulysses
General => Developers Corner => Topic started by: thetomm2010 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.
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
[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
-
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).
-
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.
-
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.
-
Lmao alright thanks
-
you can remove this thread if you want too. Ill make a new one with a new code.
-
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.
-
That makes a lot more sense.
I didn't even look up where the code was from until now... 2006. Geez.
-
Haha yeahh I wasn't playing this game at the time this came out so I'm just catching up with the times lol