General > Developers Corner

How to change playernames

<< < (2/4) > >>

Th3_§mp3r0r:

--- Quote from: Neku on January 16, 2014, 11:06:28 AM ---You're gonna need to edit things. Can't just copy and paste things over and expect them to work.

--- End quote ---

You don't say.

I wanted to understand the way darkrp does and then adapt it.

@Mr.President

I thought something like this by myself. But there must be a way to get those functions into another gamemode. The problem is, i can't figure out how it was done in the first place to modify the gamemode.

MrPresident:
It's not about getting the functions into another gamemode. It's about how the gamemode handles names.

an RP gamemode would handle names of players separately from the actual player's name. Thus, allowing you to change them.

Most gamemodes just utilize player:Nick() which grabs the player's steam name.



In order to utilize custom names, you would need to edit the gamemode you are using (including the scoreboard) to not use player:Nick() and instead use a naming system that you implement yourself.

Th3_§mp3r0r:

--- Quote from: MrPresident on January 17, 2014, 04:37:52 AM ---It's not about getting the functions into another gamemode. It's about how the gamemode handles names.

an RP gamemode would handle names of players separately from the actual player's name. Thus, allowing you to change them.

Most gamemodes just utilize player:Nick() which grabs the player's steam name.



In order to utilize custom names, you would need to edit the gamemode you are using (including the scoreboard) to not use player:Nick() and instead use a naming system that you implement yourself.

--- End quote ---

Well correct me if I'm wrong, but if it would be like that no other addon or command would work in DarkRP.
For example:
Player x changes name to y (in DarkRP).
That would mean, that rpname == y , and ply:Nick() == x .
Every other addon like ulx uses ply:Nick() to call playernames. So if I would try to "ulx kick y" it wouldn't be working because ply:Nick() is x and y doesn't exist. But the reality is different. Somehow it works for ulx to handle changed playernames. So there MUST be a way to just set rpname = ply:Nick(). If that is possible, it would be possible to do that outside that gamemode too.

Well I'm not a lua expert, but I studied computer science and I don't see any other way to get other plugins working except changing the default variables (in this case ply:Nick() ).

Neku:
Perhaps RP overwrites the ply:Nick() function?
So that way, instead of returning the actual name of the player, it returns a set name.

MrPresident:
Yeah, I don't know much about RP, but overwriting the ply:Nick() function would be a way to get it to work. Then you could change a players name pretty easily.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version