• Player:Nick() returning two different strings?
    10 replies, posted
Hello, In my code, I have the PlayerSay hook, and the PlayerInitialSpawn hook. When I use player:Nick() on PlayerSay, I get a different string then using player:Nick() on PlayerInitialSpawn. It seems that PIS is returning the DarkRP nickname, and PlayerSay is just returning a steam name (It's returning my old steam name). Help?
It's a DarkRP thing.
Is there a way to fix this? Thanks EDIT: Reason I ask, is my whole code is based around a player's nick. I'm updating the code to actually be based around the player element, and not his/hers string name.
DarkRP overwrites the playersay hook. You could try saving their name in a variable upon playerinitialspawn and then simply refference that variable for whaterver you are trying to do with playersay. EDIT: Or the other way arround. I think I misread the one that was the problem there. Lol.
It's odd it reverts back to Sandbox behaviour in the PlayerSay hook. Does both ply:Name() and ply:GetName() behave in the same way? [editline]17th March 2014[/editline] [QUOTE=DeathTech;44264865]DarkRP overwrites the playersay hook. You could try saving their name in a variable upon playerinitialspawn and then simply refference that variable for whaterver you are trying to do with playersay. EDIT: Or the other way arround. I think I misread the one that was the problem there. Lol.[/QUOTE] Changing RP names will be a problem if you save the first name.
[QUOTE=Bo98;44264909]It's odd it reverts back to Sandbox behaviour in the PlayerSay hook. Does both ply:Name() and ply:GetName() behave in the same way? [editline]17th March 2014[/editline] Changing RP names will be a problem if you save the first name.[/QUOTE] Well ply:Name() and ply:GetName() are the exact same thing as ply:Nick() according to the wiki.
Yeah, perhaps an addon is overriding ply:Nick but not the others or something. They all really shouldn't be reverting to ply:SteamName behaviour. You could check and see what ply:getDarkRPVar("rpname") is set to as well.
KFC Chicken did you use GM:PlayerSay or PlayerSay? Because if you used GM:PlayerSay it would have overwritten all other PlayerSay and just used yours.
[QUOTE=DeathTech;44265058]KFC Chicken did you use GM:PlayerSay or PlayerSay? Because if you used GM:PlayerSay it would have overwritten all other PlayerSay and just used yours.[/QUOTE] Hooks are ran before the GM:Whatever. I doubt overriding GM:PlayerSay will break Player:Nick anyway.
Thanks for all the great replies guys, I am simply using [CODE]hook.Add("PlayerSay", "Player Chat Command", function() --stuff end)[/CODE] and [CODE]hook.Add("PlayerInitialSpawn", "Player Spawn", function() --stuff end)[/CODE] Are there any good ways of going about on this? I mean, I guess I could use their SteamID's, and then just simply "cover" the SteamID up with their nickname? [editline]17th March 2014[/editline] Bump.
ply:Nick(), ply:Name() and ply:GetName() are all overidden with darkrps horrendous garbage. ply:SteamName() will return the player's actual steam name and i believe it is shared.
Sorry, you need to Log In to post a reply to this thread.