• Setting Health on Spawn for a Player
    5 replies, posted
Hi, I am trying to make a Jedi job for a server and I am wanting it to make it so the job spawns with 5000 health. How would I do this what I tried was: [CODE]TEAM_ANAKIN = DarkRP.createJob("Jedi General Anakin Skywalker", { color = Color(0,255,255,255), model = {"models/kriegsyntax/sw_752/anakin_est.mdl"}, description = [[You are the one and only Jedi General Anakin Skywalker!]], weapons = {"weapon_lightsaber"}, command = "Anakin", max = 1, salary = 150, admin = 0, vote = false, hasLicense = false, candemote = false, -- CustomCheck customCheck = function(ply) return CLIENT or table.HasValue({"Jedigeneralanakin","owner","superadmin","moderator","admin","headofstaff"}, ply:GetNWString("usergroup")) end, ply:SetHealth(5000) category = "Jedi", })[/CODE] The code above didnt't work! Thank you for any help you give! :D
*facepalm* Get a coder.
Try this (in any serverside Lua file): [LUA] hook.Add("PlayerSpawn", "SetPlayerHealth", function() if (team.GetName(ply:Team()) == "Jedi General Anakin Skywalker") then ply:SetHealth(5000) end end) [/LUA]
[code] TEAM_ANAKIN = DarkRP.createJob("Jedi General Anakin Skywalker", { color = Color(0,255,255,255), model = {"models/kriegsyntax/sw_752/anakin_est.mdl"}, description = [[You are the one and only Jedi General Anakin Skywalker!]], weapons = {"weapon_lightsaber"}, command = "Anakin", max = 1, salary = 150, admin = 0, vote = false, hasLicense = false, candemote = false, -- CustomCheck customCheck = function(ply) return CLIENT or table.HasValue({"Jedigeneralanakin","owner","superadmin","moderator","admin","headofstaff"}, ply:GetNWString("usergroup")) end, PlayerSpawn = function(ply) ply:SetHealth(5000) end, category = "Jedi", }) [/code] Reference: [url]http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields[/url]
[QUOTE=Ducky3426;49758737][code] TEAM_ANAKIN = DarkRP.createJob("Jedi General Anakin Skywalker", { color = Color(0,255,255,255), model = {"models/kriegsyntax/sw_752/anakin_est.mdl"}, description = [[You are the one and only Jedi General Anakin Skywalker!]], weapons = {"weapon_lightsaber"}, command = "Anakin", max = 1, salary = 150, admin = 0, vote = false, hasLicense = false, candemote = false, -- CustomCheck customCheck = function(ply) return CLIENT or table.HasValue({"Jedigeneralanakin","owner","superadmin","moderator","admin","headofstaff"}, ply:GetNWString("usergroup")) end, PlayerSpawn = function(ply) ply:SetHealth(5000) end, category = "Jedi", }) [/code] Reference: [url]http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields[/url][/QUOTE] This didn't work I will send you the current code I am using. [CODE]TEAM_ANAKIN = DarkRP.createJob("Jedi General Anakin Skywalker", { color = Color(0,255,255,255), model = {"models/kriegsyntax/sw_752/anakin_est.mdl"}, description = [[You are the one and only Jedi General Anakin Skywalker!]], weapons = {"weapon_lightsaber"}, command = "Anakin", max = 1, salary = 150, admin = 0, vote = false, hasLicense = false, candemote = false, -- CustomCheck customCheck = function(ply) return CLIENT or table.HasValue({"Jedigeneralanakin","owner","superadmin","moderator","admin","headofstaff"}, ply:GetNWString("usergroup")) end, PlayerSpawn = function(ply) ply:SetHealth(5000) end, category = "Jedi", })[/CODE]
AFTER catagory, put this line(put your wanted health): PlayerLoadout = function(ply) ply:SetHealth(yourhealthnumber) end,
Sorry, you need to Log In to post a reply to this thread.