Hi,
So I have a server, running a custom gamemode I made based on fretta.
My gamemode works fine, but there is a problem.
On some maps, players are dying for no reason. Like someone will die at some place on the map, then other players going at the same place will die too, as if there was some kind of "Death barrer".
I don't think this is related to my code, as the only code that can kill is actualy checking for the distance between a specific player and the others, and when players die for no reason, that specific player is most of the time far away from them.
[code]
function CLASS:Think( pl )
if GetGlobalFloat("RoundStartTime",CurTime()) + 20 < CurTime() then
for i, ply in pairs(player.GetAll()) do
if ply:Team() == TEAM_VICTIMS and ply:Alive() then
if(pl:GetPos():Distance(ply:GetPos()) < 60) then
ply:Kill();
pl:AddFrags(1);
end
end
end
end
end
[/code]
This is the code that kills. I don't think this can make the bug I have.
Screenshoot of this bug, everyone going here died for no reason...
[img]http://puu.sh/mLOWK/493458f4e2.jpg[/img]
Do you have ideas why sometimes a point on the map kills everyone ? Is there anyways to fix that ?
Thanks for your ideas
Hey,
your script causes this issue...
[code]
function CLASS:Think( pl )
if GetGlobalFloat("RoundStartTime",CurTime()) + 20 < CurTime() then
for i, ply in pairs(player.GetAll()) do
if ply:Team() == TEAM_VICTIMS and ply:Alive() then
if(pl:GetPos():Distance(ply:GetPos()) < 60) then
ply:Kill();
pl:AddFrags(1);
end
end
end
end
end
[/code]
But WHY you ask?
Ok, let me explain some things...
You'r running this on "THINK" (So, nearly every tick?) and you'r running this with a Player Object ... (Or what means pl ?)
anyway..
At this point:
[code]
if ply:Team() == TEAM_VICTIMS and ply:Alive() then
if(pl:GetPos():Distance(ply:GetPos()) < 60) then
ply:Kill();
pl:AddFrags(1);
end
end
[/code]
will sometimes (i think, all the times) ply == ply (And thats why pl:GetPos():Distance(ply:GetPos()) will be 0, so, it will be lower then 60) Just change the Script to:
[code]
function CLASS:Think( pl )
if GetGlobalFloat("RoundStartTime",CurTime()) + 20 < CurTime() then
for i, ply in pairs(player.GetAll()) do
if ply:Team() == TEAM_VICTIMS and ply:Alive() then
if(pl:GetPos():Distance(ply:GetPos()) < 60 and ply:SteamID() != pl:SteamID()) then
ply:Kill();
pl:AddFrags(1);
end
end
end
end
end
[/code]
and try it out... :)
Greets
SeaLife
Of course pl can (will) be ply at some point, but I do if ply:Team() == TEAM_VICTIMS and pl is always TEAM_PEDOBEAR so it can't kill itself. Also it's not the player from TEAM_PEDOBEAR that dies (Maybe it can, but we didn't see it happen yet) but some players from TEAM_VICTIMS, on certain points on the maps, when the player from TEAM_PEDOBEAR isn't close to them.
There is only one player on TEAM_PEDOBEAR and it this player think that execute this code
Also some players seam to think it's dead people (From TEAM_VICTIMS) that kills others alive people.
Change code to:
[code]
function CLASS:Think( pl )
if GetGlobalFloat("RoundStartTime",CurTime()) + 20 < CurTime() then
for i, ply in pairs(player.GetAll()) do
if ply:Team() == TEAM_VICTIMS and ply:Alive() and pl:Alive() and ply != pl then
if(pl:GetPos():Distance(ply:GetPos()) < 60) then
ply:Kill();
pl:AddFrags(1);
end
end
end
end
end
[/code]
and try it out... :)
Greets
SeaLife
Hi,
I did add that, and also a code to prevent suicide, and after a week, we didn't see that bug happenning again.
I don't know which fixed the bug, but thanks anyways.
Sorry, you need to Log In to post a reply to this thread.