Hi There,
I was wondering how I could set ALL JOBS' health then go to individual jobs and set their health, and speed.
if you want change[B] all jobs[/B] speed values at once without editing the gamemodes' then do something like this.
[CODE]for k, v in pairs(RPExtraTeams) do
if not v.PlayerSpawn then
v.PlayerSpawn = function( ply ) ply:SetHealth(200) ply:SetMaxSpeed(2000) ply:SetRunSpeed(400) ply:SetWalkSpeed(100) end
end
end[/CODE]
then just simply override playerspawn for each of the individual jobs.
[QUOTE=ZeBull;51028214]if you want change[B] all jobs[/B] speed values at once without editing the gamemodes' then do something like this.
[CODE]for k, v in pairs(RPExtraTeams) do
if not v.PlayerSpawn then
v.PlayerSpawn = function( ply ) ply:SetHealth(200) ply:SetMaxSpeed(2000) ply:SetRunSpeed(400) ply:SetWalkSpeed(100) end
end
end[/CODE]
then just simply override playerspawn for each of the individual jobs.[/QUOTE]
I found on a different thread how to do it, I did it like this:
TEAM_CR = DarkRP.createJob("Clone Recruit", {
color = Color(145, 145, 145, 255),
model = {"models/player/sgg/starwars/clonetrooper_clean.mdl"},
description = [[You are a Clone Recruit waiting to be trained on the Venator]],
weapons = {"weapon_752_dc15satrainingnodmg", "weapon_752_dc15atrainingnodmg"},
command = "recruit",
max = 0,
salary = 0,
admin = 0,
vote = false,
hasLicense = false,
candemote = false,
-- CustomCheck
medic = false,
chief = false,
mayor = false,
hobo = false,
cook = false,
category = "Clone Troopers",
PlayerLoadout = function(ply)
ply:SetHealth(500)
ply:SetArmor(0)
ply:SetWalkSpeed(0)
ply:SetRunSpeed(0)
})
But I am getting this error:
[ERROR] Lua is unable to understand file "darkrp_customthings/jobs.lua" because its author made a mistake around line number 26.
The best help I can give you is this:
Right before the '}', Lua encountered something it could not make sense of.
Hints:
- Did you forget something here? (Perhaps a closing bracket)
- Is it a typo?
Line 26 is the bottom line the "})"
[code]
category = "Clone Troopers",
PlayerLoadout = function(ply)
ply:SetHealth(500)
ply:SetArmor(0)
ply:SetWalkSpeed(0)
ply:SetRunSpeed(0)
end
})
[/code]
Forgot to add the end to close the function. Also, [code] tags make the code nice and pretty when you submit some in a post.
[QUOTE=stickman14714;51029722][code]
category = "Clone Troopers",
PlayerLoadout = function(ply)
ply:SetHealth(500)
ply:SetArmor(0)
ply:SetWalkSpeed(0)
ply:SetRunSpeed(0)
end
})
[/code]
Forgot to add the end to close the function. Also, [code] tags make the code nice and pretty when you submit some in a post.[/QUOTE]
[code] PlayerSpawn = function(ply) ply:SetHealth(2000) ply:SetMaxHealth(2000) end,
}) [/code]
I added this to a job, max health so that they can still be healed using a medkit. But now when I change my job, I have 2000 then when I suicide it goes to 100.
Sorry, you need to Log In to post a reply to this thread.