The code is pretty simple I will explain it
[CODE]FAC_A = {
"TEAM_R1",
"TEAM_R2",
"TEAM_R3",
"TEAM_R4",
"TEAM_R5",
"TEAM_R6",
"TEAM_R7",
"TEAM_R8",
"TEAM_R9",
"TEAM_R10",
"TEAM_R11",
"TEAM_R12",
"TEAM_R13",
"TEAM_R14",
}
FAC_B = {
"TEAM_C1",
"TEAM_C2",
"TEAM_C3",
"TEAM_C4",
"TEAM_C5",
"TEAM_C6",
"TEAM_C7",
"TEAM_C8",
"TEAM_C9",
"TEAM_C10",
"TEAM_C11",
"TEAM_C12",
}
local function getfaction(ply) -- 0 = facA | 1 = facB
teamName = team.GetName(ply:Team())
if table.HasValue(FAC_A, teamName) then
return 0
elseif table.HasValue(FAC_B, teamName) then
return 1
else
return false
end
end
hook.Add("EntityTakeDamage", "noteamkill", function(ply, dmg)
if !ply:IsPlayer() then return end
if !dmg:GetAttacker():IsPlayer() then return end
target = dmg:GetAttacker()
if (getfaction(target) == false) or (getfaction(ply) == false) then
return
else
if getfaction(target) == getfaction(ply) then
return true
else
return
end
end
end)[/CODE]
FAC_A shouldnt be able to kill each other,
FAC_B shouldnt be able to do that aswell
but A and B should be able to fight each other
Somehow the code isnt working and not a single lua error appears
>I put the lua into autorun/server
help would be appreciated
why you added double else? you only need to override if same team to take no damage.
I will check that soon.
Merry Christmas:goodjob:
[QUOTE=kem008;51578492]why you added double else? you only need to override if same team to take no damage.
I will check that soon.
Merry Christmas:goodjob:[/QUOTE]
I tried alot and ended up with this,
I dont kno what to do I really hope you can help me if you find time :cry:
you tried also this hook? PlayerShouldTakeDamage
[QUOTE=kem008;51578534]you tried also this hook? PlayerShouldTakeDamage[/QUOTE]
No I didnt, should I have done so?
Could you put some "print([A recognisable unique string])" In key places like in some if statements in each function? This would give a much better understanding on what is happening for you. Let me know if any of the print's outputs to the console. Show me the new code and let me know what the output is.
Lets see if we can figure this out :)
Sorry, you need to Log In to post a reply to this thread.