General > Developers Corner

DarkRP nil name in XGUI. (Possible Fix?)

(1/2) > >>

LuaTenshi:
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.


--- Code: ---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 )

--- End code ---

---

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. )


--- Code: ---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 )

--- End code ---

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?

Megiddo:
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?

LuaTenshi:

--- Quote from: Megiddo on May 27, 2012, 09:00:13 AM ---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?

--- End quote ---

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.

Stickly Man!:
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?)

Schiaffino:
yes sticky the 2.4.2 version ( of DarkRP ) ( SVN Version )

Navigation

[0] Message Index

[#] Next page

Go to full version