• Why not go the auto rename?
    6 replies, posted
TEAM_POLICE = DarkRP.createJob("Civil Protection", {     color = Color(25, 25, 170, 255),     model = {"models/DPFilms/Metropolice/Playermodels/pm_hl2beta_police.mdl", "models/player/police_fem.mdl"},     description = [[The protector of every citizen that lives in the city.         You have the power to arrest criminals and protect innocents.         Hit a player with your arrest baton to put them in jail.         Bash a player with a stunstick and they may learn to obey the law.         The Battering Ram can break down the door of a criminal, with a warrant for their arrest.         The Battering Ram can also unfreeze frozen props (if enabled).         Type /wanted <name> to alert the public to the presence of a criminal.]],     weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker"},     command = "cp",     max = 4,     salary = GAMEMODE.Config.normalsalary * 1.45,     admin = 0,     vote = true,     hasLicense = true,     ammo = {         ["pistol"] = 60,     },     category = "Civil Protection", PlayerLoadout = function(ply) ply:SetArmor(30)  ply:setRPName(string "CP-RCT" math.random( 100000, 999999 ), boolean true) end, })
The string before "CP-RCT" and boolean before true are not needed. They are only there in the documentation so you know what to type there. You also forgot to add .. after "CP-RCT" Should be: ply:setRPName("CP-RCT " .. math.random( 100000, 999999 ), true) end,
Does not indicate an error but not even rename the player. TEAM_POLICE = DarkRP.createJob("Civil Protection", {     color = Color(25, 25, 170, 255),     model = {"models/DPFilms/Metropolice/Playermodels/pm_hl2beta_police.mdl", "models/player/police_fem.mdl"},     description = [[The protector of every citizen that lives in the city.         You have the power to arrest criminals and protect innocents.         Hit a player with your arrest baton to put them in jail.         Bash a player with a stunstick and they may learn to obey the law.         The Battering Ram can break down the door of a criminal, with a warrant for their arrest.         The Battering Ram can also unfreeze frozen props (if enabled).         Type /wanted <name> to alert the public to the presence of a criminal.]],     weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker"},     command = "cp",     max = 4,     salary = GAMEMODE.Config.normalsalary * 1.45,     admin = 0,     vote = true,     hasLicense = true,     ammo = {         ["pistol"] = 60,     },     category = "Civil Protection", PlayerLoadout = function(ply) ply:SetArmor(30)  ply:setRPName("CP-RCT " .. math.random( 100000, 999999 ), true) end, })
I would just run a console command on the player like: ply:ConCommand( "say /rpname CP-RCT " .. math.random( 100000, 999999 )" )
Have you tried calling it with this instead? OnPlayerChangedTeam = function(ply, oldTeam, newTeam) end,
Does not work does not rename the player ply:ConCommand( "say /rpname CP-RCT " .. math.random( 100000, 999999 ) ) end,
When do you call it?
Sorry, you need to Log In to post a reply to this thread.