How to make it so a certain job respawns if choosen.
11 replies, posted
so to be exact my question is how can i make just one job a specific job. respawn if choosen/switched to.
Please note i only want just 1 job not all the jobs.
so i was wondering if anyone knows how? to do this please do tell me.
try adding this to the table which you pass when you make a new team/job
OnPlayerChangedTeam = function(ply, oldTeam, newTeam) ply:Spawn() end
testing now but another question. is it possible to make
the same job not damage each other?
Example: job 1 cannot damage job 1.
function GM:EntityTakeDamage( target, dmginfo )
if ( target:IsPlayer() and dmginfo:IsGetDamage() ) then return false
end
end
ill add a hook i get it but. still no clue how to apply this for the team. specific job.
ply.SetHealth doesn't exist, you're looking for ply:SetHealth
I don't know why you would use PlayerHurt instead of EntityTakeDamage. If you read the wiki for it, there's a super easy to way to stop the damage event.
And I don't know, you'll have to find out if it works or not.
local team_damage_off = {
["team_name"] = true
}
hook.Add("PlayerShouldTakeDamage", "johnson_block_team_damage", function(ply, attacker)
if not (IsValid(ply) and IsValid(attacker)) then return false end
local ply_team, attacker_team = team.GetName(ply:Team()), team.GetName(attacker:Team())
return not (team_damage_off[ply_team] and ply_team == attacker_team)
end)
I simply. edited it. i removed but still didn't work. ill try your code fancy ty
ply.SetHealth(hr + dd)
function NoTeamDamage( ply, atk, hr, dd )
if ( ply:Team() == TEAM_D1J && atk:IsPlayer() && atk:Team() == TEAM_D1J ) then return false
end
end
hook.Add( "PlayerHurt", "NoTeamDamage", NoTeamDamage )
Please just try to fix it.
Here's a hint, I doubt the name of your team is TEAM_D1J
i tried D1J as well. it didn't work.
TEAM_D1J = DarkRP.createJob("D1J", {
color = Color(205, 105, 155, 255),
model = {"models/player/alyx.mdl"},
description = [[Micspam all the way.]],
weapons = {""},
command = "d1j",
OnPlayerChangedTeam = function(ply, oldTeam, newTeam) ply:Spawn() end,
max = 3,
salary = 300,
admin = 0,
vote = false,
hasLicense = false,
candemote = true,
category = "Citizens"
})
TEAM_D1J is not a string, and D1J is not the name of the TEAM.
Think about it.
all good solved it. ty anyway for trying to help.
Sorry, you need to Log In to post a reply to this thread.