Yo, I recently started working on my first gamemode, and the goal is to propkill eachother with the Magneto Stick. I need an alternative. The Magneto Stick from TTT has a bunch of errors that I fixed, but now, if I swing a prop too fast, it crashes the entire server (dedicated or listen). It's really frustrating and would not be able to work in a server. How could I replicate the effects of the magneto stick, or fix the crashing part? I'm not asking for someone to make it for me (unless you want to xD), I just need a push in the right direction. Thanks!
Why not just use the gravity gun?
But if you are determined just right a script that removes a prop if it moves too fast. This should fix the crashing bug.
Upon further investigation, I found out that it's not when I swing it too fast, it's when I kill the 2nd to last player alive with it. Any ideas on the cause? It doesn't crash when I slay the second to last, only when I propkill them with the Magneto Stick. I have a round system script that activates when there's less than 2 people on the player team. It looks like this:
[code]
function GM:PlayerDeath(ply, inflictor, attacker)
-- just in case i guess?
if ply:Team() == 1 then return end
-- would there be 1 person left if we changed him?
if team.NumPlayers(2) <= 2 then
-- end of round: set everyone back to normal
for _,ply in pairs(team.GetPlayers(2)) do
PrintMessage(HUD_PRINTCENTER, ply:GetName().. " wins! Restarting...")
game.CleanUpMap()
for k, v in pairs(player.GetAll()) do
v:SetTeam(2)
v:Spawn()
end
return
end
else
ply:SetTeam(1)
end
end
[/code]
Thanks!
Try this:
[CODE]function GM:PlayerDeath(ply, inflictor, attacker)
-- just in case i guess?
if ply:Team() == 1 then return end
-- would there be 1 person left if we changed him?
if team.NumPlayers(2) <= 2 then
-- end of round: set everyone back to normal
for _,ply in ipairs(team.GetPlayers(2)) do
PrintMessage(HUD_PRINTCENTER, ply:GetName().. " wins! Restarting...")
game.CleanUpMap()
for k, v in pairs(player.GetAll()) do
v:SetTeam(2)
v:Spawn()
end
return
end
else
ply:SetTeam(1)
end
end[/CODE]
[QUOTE=Fortune11709;42352733]Try this:
[CODE]function GM:PlayerDeath(ply, inflictor, attacker)
-- just in case i guess?
if ply:Team() == 1 then return end
-- would there be 1 person left if we changed him?
if team.NumPlayers(2) <= 2 then
-- end of round: set everyone back to normal
for _,ply in ipairs(team.GetPlayers(2)) do
PrintMessage(HUD_PRINTCENTER, ply:GetName().. " wins! Restarting...")
game.CleanUpMap()
for k, v in pairs(player.GetAll()) do
v:SetTeam(2)
v:Spawn()
end
return
end
else
ply:SetTeam(1)
end
end[/CODE][/QUOTE]
Does the same thing :( Thanks anyways. Any other ideas?
What's the crash message? It could do with the engine error bug that's still occurring.
[QUOTE=code_gs;42353563]What's the crash message? It could do with the engine error bug that's still occurring.[/QUOTE]
There is no crash message. The dedicated server stops responding and eventually closes. Listen server instantly closes.
EDIT: Closing thread and starting a new one as the issue has been changed.
Sorry, you need to Log In to post a reply to this thread.