Ulysses
General => Developers Corner => Topic started by: LuaTenshi on May 26, 2012, 09:29:31 PM
-
I have figured out why players appear as nil in DarkRP. It is because as soon as some one initially spawns DarkRP makes it so that their name is nil, then it sets their name to their DarkRP name. I have tried making a fix but I can not get it working, and by cant get it working I mean, it works with no errors, but instead of acctually putting your name in it makes more nils, who are pretty much you, so then you have a whole cluster of you's in your XGUI. And thats not what I want it to do if any one can help me get some sort of code working, I am sure that every one will be thankful.
function unilUserFix( ply )
timer.Create( "PlySpawnRankT_" .. ply:UserID(), 1.5, 1, ULib.ucl.addUser( ply:UniqueID(), nil, nil, ply:GetUserGroup() ) )
end
hook.Add( "PlayerInitialSpawn", "UlxNilUserFix", nilUserFix )
---
I have made some modifications, and it seems like it works, except that it breaks some client side parts of the XGUI. ( I would love if some one could help me with this. )
function unilUserFix( ply )
timer.Create( "PlySpawnRankT_" .. ply:UserID(), 2.5, 1, ULib.ucl.addUser( ply:UniqueID(), nil, nil, ply:GetUserGroup() ) )
timer.Create( "PlySpawnRankTr_" .. ply:UserID(), 3, 1, ULib.ucl.removeUser( ply:UniqueID() ) )
timer.Create( "PlySpawnRankTm_" .. ply:UserID(), 3.5, 1, ply:PrintMessage( HUD_PRINTTALK, "Hello, " .. ply:GetUserGroup() .. " " .. ply:Name() ) )
end
hook.Add( "PlayerSpawn", "UlxNilUserFix", unilUserFix )
I am adding then removing the same user because for some reason, the first one creates a duplicate, removing them seems to fix the problem while not removing them from their rank. The problem, is that doing the add and remove seems to break the client side part of the XGUI. So I don't think that will work out.
Should I make the wait interval between the timers bigger?
-
Not sure why this would break XGUI, but as far as the duplicate user you were seeing: most users are added by SteamID. When you add them again by unique id, it creates a new (higher priority) entry. Can you share the offending DarkRP code with us?
-
Not sure why this would break XGUI, but as far as the duplicate user you were seeing: most users are added by SteamID. When you add them again by unique id, it creates a new (higher priority) entry. Can you share the offending DarkRP code with us?
If I can find it. I only noticed that DarkRP does it because I saw that a player joined as nil, and then after about half a second their name changed to what its supposed to be.
-
This is something I *still* haven't gotten around to looking into (mumblegrumblelazy). I'm going to try to look into it tonight or tomorrow, If you can find the offending code in DarkRP for me, then that would help me out much :)
(Also, I presume that this http://darkrp.googlecode.com/svn/trunk/ is the svn to the DarkRP version everyone is using?)
-
yes sticky the 2.4.2 version ( of DarkRP ) ( SVN Version )
-
I'm positive there has been quite a few tickets submitted about this issue with DarkRP I know I myself have submitted one. However if they can't recreate the problem then they won't fix it.
Also keep in mind with every new revision it's possible FTPJE has fixed something or rewritten a function that could interfere with the code you're working on... (I'm sure you've thought of this already I'm just putting my two cents in....not really helpful...I'm gonna go now....)
-
Well, that was easier to fix than I thought it would be. This error is caused by a small mistake in DarkRP's code-- I'll be contacting the developer right away.
If you want to fix it right now, open up darkrp\gamemode\init.lua, and replace line 34:
return tostring(self.DarkRPVars.rpname) or self:SteamName()
With this line:
return self.DarkRPVars.rpname and tostring(self.DarkRPVars.rpname) or self:SteamName()
Then do a changemap and your problem should be solved!
-
Update:
I did successfully get a hold of the FPtje, and I confirmed that he did indeed get the issue fixed and pushed several days ago in DarkRP SVN rev. 1176.
If you're still seeing "nil" on some names, then you should remove / readd them, or wait for them to join (as that should fix it).
-
Update:
I did successfully get a hold of the FPtje, and I confirmed that he did indeed get the issue fixed and pushed several days ago in DarkRP SVN rev. 1176.
If you're still seeing "nil" on some names, then you should remove / readd them, or wait for them to join (as that should fix it).
Okay thank you very much.
(...and sorry for bumping, but a thanks had to be said.)