• Jobs to Certain People Only
    10 replies, posted
Hey I was wondering if I could make a job given only to certain people like by steam ID or something. I made a job and I want it this done to it how do I do it. The job is TEAM_CORP = AddExtraTeam("The Corporation", Color(23,221,207,255), "models/Characters/Hostage_02.mdl", [[Kill the fucking Resistance]], {"AK47"}, "corp", 3, 50, 1, false) I know that right now only admins can be it but I like said I want it to be for only me and 2 other people i choose
if pl:SteamID() == <steamID of player> then <change team>
its hard to change this in darkrp because it not use the regulars hook on team changed but you can do this: [lua]timer.Create( "checkChangeteam", 10, 0, function() for k, v in ipairs(player.GetAll()) do if v:Team() == TEAM_CORP and v:SteamID() != <yoursteamidhere> or v:SteamID() != <anothersteamidhere> or v:SteamID() != <anothersteamidhere> then -- put here your and the person's you want to be able to use this team steamid here. RunConsoleCommand("rp_citizen "..v:Nick()) end end end )[/lua]this will check every 10 second if a player is in the team "TEAM_CORP" and if the player's steamid is right for this team. if the player has not the good steamid he'll be changed team to citizen. I dosen't test this code but it should work and i know its not an good way because the timer'll be executed all the time but its the simplest way to do this.
[QUOTE=slay3r36;22589093]this will check every 10 second if a player is in the team "TEAM_CORP" and if the player's steamid is right for this team. if the player has not the good steamid he'll be changed team to citizen. I dosen't test this code but it should work and i know its not an good way because the timer'll be executed all the time but its the simplest way to do this.[/QUOTE] Or, just do all this at PlayerSpawn, instead of calling the function every 10th-freaking-second.
[QUOTE=Busymonkey;22621318]Or, just do all this at PlayerSpawn, instead of calling the function every 10th-freaking-second.[/QUOTE] What if they dont have the option to force respawn when you change job( like most servers don't ). Then they will be able to use the job until they die.
[QUOTE=sintwin;22630298]What if they dont have the option to force respawn when you change job( like most servers don't ). Then they will be able to use the job until they die.[/QUOTE] Just manually kill them.
[QUOTE=Legend286;22630882]Just manually kill them.[/QUOTE] That would be a very bad way to do it. You could just go to player.lua in DarkRP, which is where job changing is handled. Go to line 231 and paste this in. [lua] if t == TEAM_CORP and not self:SteamID() == "STEAM" or not self:SteamID() == "STEAM" then Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), "This is a restricted job!")) return end [/lua] But ofcourse change "STEAM" to whatever your steamID is, E.G "STEAM:0:12324345"
[QUOTE=sintwin;22630298]Then they will be able to use the job until they die.[/QUOTE] ... uhm, yea?
[QUOTE=Busymonkey;22658227]... uhm, yea?[/QUOTE] Yeah so what's the point in doing it like that. Seen as it wont really be restricted as people can still use it
Then why don't they just implant a force respawn function?
[QUOTE=Bagasen;22658597]Then why don't they just implant a force respawn function?[/QUOTE] There is one that can be toggled on and off, but you could just use the code I posted earlier which would work without respawning.
Sorry, you need to Log In to post a reply to this thread.