Lua 我能';你不运行我的代码吗?

Lua 我能';你不运行我的代码吗?,lua,garrys-mod,Lua,Garrys Mod,我为garry的模式编写了一个脚本,使用lua编写了一个脚本,允许我在绑定钥匙时进行跳跃,然后360度旋转和射击,但当我完成编码后,它不会让我对其进行测试,为什么会这样,你能碰巧告诉我代码中的错误吗。我也有90%的把握,这个回合不会达到360度,所以如果你能帮我,我会很高兴的。谢谢 代码: 好吧,我开始工作了 首先,您不能用数字启动函数,所以请更改 function 360JumpShot() concommand.ADD("360Jump",360JumpShot) 到 注意,我还将ADD改

我为garry的模式编写了一个脚本,使用lua编写了一个脚本,允许我在绑定钥匙时进行跳跃,然后360度旋转和射击,但当我完成编码后,它不会让我对其进行测试,为什么会这样,你能碰巧告诉我代码中的错误吗。我也有90%的把握,这个回合不会达到360度,所以如果你能帮我,我会很高兴的。谢谢 代码:


好吧,我开始工作了

首先,您不能用数字启动函数,所以请更改

function 360JumpShot()
concommand.ADD("360Jump",360JumpShot)

注意,我还将ADD改为ADD,因为LUA区分大小写,考虑到。。改变

timer.simple(.01,jump)
timer.simple(.02,turn)
timer.simple(.04,turn)
timer.simple(.06,turn)
timer.simple(.08,turn)
timer.simple(.10,turn)
timer.simple(.7,function() RunConsoleCommand("+attack") end)
timer.simple(.72,function() RunConsoleCommand("-attack") end)


在这些更改之后,您的脚本工作正常,但您可能希望找到一种移动速度更快的方法,因为您的相机移动速度非常慢,并且可能与您想要的不完全一致。

函数名不能以数字开头。“它不允许我”,这意味着什么,您是否遇到错误?如果是,则在问题中提供完整的错误消息。此外,有时您使用大写字母“s”编写
simple
,有时使用小写字母。它应该是小写或大写,请阅读。
function JumpShot()
concommand.Add("360Jump",JumpShot)
timer.simple(.01,jump)
timer.simple(.02,turn)
timer.simple(.04,turn)
timer.simple(.06,turn)
timer.simple(.08,turn)
timer.simple(.10,turn)
timer.simple(.7,function() RunConsoleCommand("+attack") end)
timer.simple(.72,function() RunConsoleCommand("-attack") end)
timer.Simple(.01,jump)
timer.Simple(.02,Turn)
timer.Simple(.04,Turn)
timer.Simple(.06,Turn)
timer.Simple(.08,Turn)
timer.Simple(.10,Turn)
timer.Simple(.7,function() RunConsoleCommand("+attack") end)
timer.Simple(.72,function() RunConsoleCommand("-attack") end)