• DarkRP Name Changer
    12 replies, posted
Hi guys, im trying to change player's name automaticly when player spawns. i coded this but it won't work: [CODE] AddCSLuaFile( "autorun/client/cl_init.lua" ) names = { "name01", "name02", "name03" } name = table.Random(names) function namechanger(ply, self) RunConsoleCommand("rp_setname ", ply , name) ply:PrintMessage(HUD_PRINTTALK, "You just changed your name to " .. name) end hook.Add("PlayerSpawn", "NameChanger", namechanger) [/CODE] i also tried: [CODE] AddCSLuaFile( "autorun/client/cl_init.lua" ) names = {"name01", "name02", "name03"} function namechanger(ply, self) RunConsoleCommand("rp_setname ", ply , table.Random(names)) ply:PrintMessage(HUD_PRINTTALK, "You just changed your name") end hook.Add("PlayerSpawn", "NameChanger", namechanger) [/CODE] Console Output: [IMG]http://i.hizliresim.com/EQd05g.jpg[/IMG]
"rp_setname " remove the space
it didn't worked
What is the error now?
No errors at console, my name is still not changed. [editline]27th August 2014[/editline] Can someone help?
Send only the players current nick instead of the whole player object [editline]27th August 2014[/editline] Also get rid of the global variables. There's no need for it.
i want to change every people's name in my server.
And...? The players nick is returned on the Nick method. You in then pass it to the rp setname concommand. The edits I said did not change functionality but would make your code work. (I think)
[QUOTE=crazyscouter;45815706]Send only the players current nick instead of the whole player object[/QUOTE] It would be more accurate to use steamid.
[QUOTE=StonedPenguin;45820484]It would be more accurate to use steamid.[/QUOTE] Thanks for the info. Going off the documentation which stated to use the player's current name.
I Fixed it guys, Thanks!
[code] myTable={ "tyrone", "bob", "joe" } ply:setRPName(table.Random(myTable) ) [/code]
i dont neet that now, i solved the problem. ply:Nick() works.
Sorry, you need to Log In to post a reply to this thread.