• Error in Code
    4 replies, posted
This is probably a really simple fix. I get this error code:[CODE] [ERROR] addons/spawnspec/lua/autorun/cl_intro.lua:2: attempt to call global 'activemap' (a nil value) 1. func - addons/spawnspec/lua/autorun/cl_intro.lua:2 2. unknown - lua/includes/extensions/net.lua:32 [/CODE] When running this: [CODE]net.Receive( "SpawnFOV", function( len ) if activemap() == "ttt_minecraft_b5" then plyPos = net.ReadVector(-2124.893311, 399.857788, 1182.543335) plyAng = net.ReadAngle(25.320227, -14.572645, 0.000000) elseif activemap() == "ttt_clue_se" then plyPos = net.ReadVector(33.211891, 458.652588, 296.782440) plyAng = net.ReadAngle(15.771698, -63.144417, 0.000000) elseif activemap() == "ttt_community_bowling_v5a" then plyPos = net.ReadVector(1627.979248, 1348.835449, 303.732056) plyAng = net.ReadAngle(6.557766, -142.084824, 0.000000) elseif activemap() == "ttt_rooftops_a2" then plyPos = net.ReadVector(-580.010315, -1593.101074, 1118.506592) plyAng = net.ReadAngle(24.864820, 51.642372, 0.000000) elseif activemap() == "ttt_67thway_v14" then plyPos = net.ReadVector(283.739288, 1945.326294, 234.155838) plyAng = net.ReadAngle(1.092958, -100.148743, 0.000000) else return true end end ) function getcurrentmap() activemap = game.GetMap() end [/CODE]
[QUOTE=djmuz;48441977]This is probably a really simple fix. I get this error code:[CODE] [ERROR] addons/spawnspec/lua/autorun/cl_intro.lua:2: attempt to call global 'activemap' (a nil value) 1. func - addons/spawnspec/lua/autorun/cl_intro.lua:2 2. unknown - lua/includes/extensions/net.lua:32 [/CODE] When running this: [CODE]net.Receive( "SpawnFOV", function( len ) if activemap() == "ttt_minecraft_b5" then plyPos = net.ReadVector(-2124.893311, 399.857788, 1182.543335) plyAng = net.ReadAngle(25.320227, -14.572645, 0.000000) elseif activemap() == "ttt_clue_se" then plyPos = net.ReadVector(33.211891, 458.652588, 296.782440) plyAng = net.ReadAngle(15.771698, -63.144417, 0.000000) elseif activemap() == "ttt_community_bowling_v5a" then plyPos = net.ReadVector(1627.979248, 1348.835449, 303.732056) plyAng = net.ReadAngle(6.557766, -142.084824, 0.000000) elseif activemap() == "ttt_rooftops_a2" then plyPos = net.ReadVector(-580.010315, -1593.101074, 1118.506592) plyAng = net.ReadAngle(24.864820, 51.642372, 0.000000) elseif activemap() == "ttt_67thway_v14" then plyPos = net.ReadVector(283.739288, 1945.326294, 234.155838) plyAng = net.ReadAngle(1.092958, -100.148743, 0.000000) else return true end end ) function getcurrentmap() activemap = game.GetMap() end [/CODE][/QUOTE] Use the function before receiving the net. Also you are using a function argument on a variable.
Replace [CODE] if activemap() == "ttt_minecraft_b5" then [/CODE] With [CODE] if game.GetMap() == "ttt_minecraft_b5" then [/CODE]
[QUOTE=tzahush;48442164]Use the function before receiving the net. Also you are using a function argument on a variable.[/QUOTE] Even if he called the right function, it's not returning anything. [CODE] function activemap() return game.GetMap() end [/CODE] Putting that before the net should work. You could save the processing power of having to call game.GetMap() each time by just making it a local variable in the net. [CODE] net.Receive( "SpawnFOV", function( len ) local curmap = game.GetMap() if curmap == "ttt_minecraft_b5" then ... [/CODE]
[QUOTE=SexyBeast70;48442171]Replace [CODE] if activemap() == "ttt_minecraft_b5" then [/CODE] With [CODE] if game.GetMap() == "ttt_minecraft_b5" then [/CODE][/QUOTE] This worked for me. I didn't even need the activemap function at all. Thank you!
Sorry, you need to Log In to post a reply to this thread.