Hey I'm linkis20 an Developer/Co-Owner for the
Blade Server.
Sometimes i code custom things for the TTT server for fun.
Now what I'm trying to make is an dual system where 2 players can fight it out.
It is far from done but this part is where I'm stuck.
All I'm trying to do is if someone attacks one of the players that are in an dual they can't hurt them.
They can only hurt each other but others can't hurt them.
If i can get this to work i may can make it so that they can't hurt others as well.
So what i have now is this.
function GM:PlayerShouldTakeDamage(victim, attacker)
//dualactive = True or False.
//dualchallenger = calling_ply
//dualplayer = target_ply
if dualactive == true then
if (victim:SteamID() == dualplayer:SteamID()) then
if attacker:IsPlayer() then
if (attacker:SteamID() == dualchallenger:SteamID()) then
return true;
else
return false;
end
else
return false;
end
elseif (victim:SteamID() == dualchallenger:SteamID()) then
if attacker:IsPlayer() then
if (attacker:SteamID() == dualplayer:SteamID()) then
return true;
else
return false;
end
else
return false;
end
else
return true;
end
else
return true;
end
end
But this is not working.
When i activate an dual others can hurt me and the other player.
I tested it with an bot and 1 other player. he could hurt me and the bot so i don't know what I'm doing wrong here.
Is it not working because i use SteamID to check if it works?
What is an better way to do this?
Can you help me with this?
Thanks for reading.