Garry's Mod

Garry's Mod

nZombies - A Nazi Zombies Gamemode [Content Pack]
Wolfy_Paws 2017 年 10 月 9 日 下午 2:52
what i am i doing wrong pls someone help me
i have made like 4 configs for nzombies and i am currently trying to script in sould catchers for one what i am i doing wrong here in my code:

local mapscript = {}

-- Any function added to this table will automatically get hooked to the hook with the same name
function mapscript.OnGameBegin()
local collector = ents.Create("nz_script_soulcatcher")
end
collector:SetNoDraw(true)
collector:SetPos(Vector(0,0,0)) -- Change this
collector:SetModel("models/hunter/blocks/cube025x025x025.mdl")
collector:Spawn()
collector:SetTargetAmount(20)
collector:SetRange(300)

collector:SetCompleteFunction( function(self)
nzDoors:OpenLinkedDoors("hiddendoor")
self:Remove()
end)
collector:SetCondition( function(self, z, dmg)
return nzElec.Active
end)
-- E.g. this function will run with the OnGameBegin hook
end

-- Always return the mapscript table. This gives it on to the gamemode so it can use it.
return mapscript
< >
正在显示第 1 - 6 条,共 6 条留言
Zet0r  [开发者] 2017 年 10 月 9 日 下午 3:26 
What is the error? This works for just making a soul collector that opens doors with the "hiddendoor" flag and requires electricity to be able to collect souls.
Wolfy_Paws 2017 年 10 月 9 日 下午 3:40 
[ERROR] addons/nzombies-master-workshop/lua/nzmapscripts/nz_gm_freddypizzaday;fnaf2.lua:2: '<eof>' expected near 'end'
1. unknown - addons/nzombies-master-workshop/lua/nzmapscripts/nz_gm_freddypizzaday;fnaf2.lua:0


[ERROR] addons/nzombies-master-workshop/gamemodes/nzombies/gamemode/mapping/sh_mapscripthandler.lua:34: bad argument #1 to 'pairs' (table expected, got nil)
1. pairs - [C]:-1
2. LoadScript - addons/nzombies-master-workshop/gamemodes/nzombies/gamemode/mapping/sh_mapscripthandler.lua:34
3. Correct - addons/nzombies-master-workshop/gamemodes/nzombies/gamemode/mapping/sh_mismatch.lua:491
4. func - addons/nzombies-master-workshop/gamemodes/nzombies/gamemode/mapping/sh_mismatch.lua:15
5. unknown - lua/includes/extensions/net.lua:32


that is the exact error i get
Wolfy_Paws 2017 年 10 月 10 日 上午 8:45 
I still don’t get what it means cause if I just past the base script snippet in and nothing else it works but if I add the soul catcher snippet it comes back with script errors
Zet0r  [开发者] 2017 年 10 月 11 日 上午 11:36 
You have an 'end' too much on line 6.
Wolfy_Paws 2017 年 10 月 11 日 上午 11:39 
so what i need to delete the () on line 6?
Zet0r  [开发者] 2017 年 10 月 12 日 上午 10:18 
引用自 Cybergamerknight
so what i need to delete the () on line 6?
I can't count lines when you posted your code outside of [ CODE ] blocks, but you have a single line somewhere around 6 that only has an 'end'. That end is an end too much. Please use a code program that highlights functions and ends so you can see where things end when they aren't supposed to. Also use indentation (tab).
最后由 Zet0r 编辑于; 2017 年 10 月 12 日 上午 10:19
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50