Is it okay to use a timer like so in GM:OnNPCKilled?


function VictoryBehavior()
for k, v in pairs(player.GetAll()) do
v:SetNWString("victorybehavior", "yes")
end
timer.Simple( 10, MapChange() )
end

function GM:OnNPCKilled()
VictoryBehavior()
end


Is it okay to use a timer like this with OnNPCKilled?

You can use a timer if you want, but that code is just dumb. Also, most of your threads fall into the “problems that dont deserve their own thread” category. Just test the code and see if it works, no reason to make a thread asking if it will work.

Dumb? How? I know the code will work, it’s just a matter if it is okay to use. Kind of like how using a timer in a SWEP’s primary fire function works for 3-round burst codes, but it messes up prediction.

Why have a separate function when you just do a single call in OnNPCKilled? Why have an NWString to just say “yes” when you can just use a bool?