• Lua error disappears if I edit the file while server is running?
    5 replies, posted
Hey... I don't know if any of you can help me with this, I'm bad with lua and I have some problem with my gamemode code. For some reason it throws an error if I just try to play as normal BUT if I open the init.lua, edit nothing, save and re-upload to the server while the server is already running then the error disappears... it's so confusing :rollout:
Something is undefined when the code is ran, but defined when you update it (Probably) What's the error?
it's an error about giving pointshop points for taunts in prop hunt
Post the code. Also tell us where it is (full file path relative to steamapps/GarrysMod/garrysmod/).
garrysmod/gamemodes/prop_hunt/gamemode/init.lua line 506 [CODE] -- Not networking, selecting random taunt if GAMEMODE:InRound() and ply:Alive() and (ply:Team() == TEAM_HUNTERS || ply:Team() == TEAM_PROPS) and ply.taunt_delay <= CurTime() and #PROP_TAUNTS > 1 and #HUNTER_TAUNTS > 1 then if ply:Team() == TEAM_HUNTERS then repeat rand_taunt = table.Random(HUNTER_TAUNTS) until rand_taunt[2] != ply.last_taunt else repeat rand_taunt = table.Random(PROP_TAUNTS) until (rand_taunt[2] != ply.last_taunt) and (tonumber(rand_taunt[3]) > minTauntDuration) end ply:EmitSound(rand_taunt[2]) ply.taunt_delay = CurTime() + rand_taunt[3] ply.last_taunt = rand_taunt[2] local PointsForTauntAmount = math.Round(rand_taunt[3] / 2) if (ply.last_point_time <= CurTime()) and (ply:Team() == TEAM_PROPS) and PointsForTaunt() then ply:PS_GivePoints(PointsForTauntAmount) ply:PS_Notify("You got " .. PointsForTauntAmount .. " " .. PS.Config.PointsName .. " for taunting!") end hook.Run("ST_Taunt",ply) end end -- Called when player presses [F3]. Plays a taunt for their team function GM:ShowSpare1(ply) --local emptything = nil --RequestTaunt(emptything,ply) end function RequestRandomTaunt(len,ply) RequestTaunt(nil,ply) end[/CODE] line540 [ERROR] gamemodes/prop_hunt/gamemode/init.lua:524: attempt to call global 'PointsForTaunt' (a boolean value) 1. RequestTaunt - gamemodes/prop_hunt/gamemode/init.lua:524 2. func - gamemodes/prop_hunt/gamemode/init.lua:539 3. unknown - lua/includes/extensions/net.lua:32
PointsForTaunt is a boolean whle you are trying to add a number
Sorry, you need to Log In to post a reply to this thread.