Gouldron
Member
just fyi, the script raises this lua warning when someone becomes spectator:
this happens because
Code:
WARNING: ...portForVanillaChars-Beta-v1.2.pk3|Lua/LUA_ALLHUG.lua:252: attempt to index field 'mo' (a nil value)
stack traceback:
...portForVanillaChars-Beta-v1.2.pk3|Lua/LUA_ALLHUG.lua:252: in function <...portForVanillaChars-Beta-v1.2.pk3|Lua/LUA_ALLHUG.lua:228>
this happens because
player.mo
is nil
on a spectator, so you need to handle that case. the easiest way to handle this ime is just to check if this on the first line of the function in question and just return if it's nil
, for example:
Code:
local function DoAThing(player)
if not player.mo then
return
end
-- other stuff
end