LUA:在if-not-then语句中使用多个变量?
我正在为garrysmod服务器编写一个脚本,对此我完全是空白,我以前记得,但现在记不起来了 我正在使用这段代码LUA:在if-not-then语句中使用多个变量?,lua,garrys-mod,Lua,Garrys Mod,我正在为garrysmod服务器编写一个脚本,对此我完全是空白,我以前记得,但现在记不起来了 我正在使用这段代码 if ent:IsVehicle() then if ent:GetModel() ~= { "models/mafia2/shubert_taxi.mdl", "models/mafia2/parry_bus.mdl", "models/mafia2/smith_200_p_pha.mdl" } then client:Freeze(true)
if ent:IsVehicle() then
if ent:GetModel() ~= { "models/mafia2/shubert_taxi.mdl", "models/mafia2/parry_bus.mdl", "models/mafia2/smith_200_p_pha.mdl" } then
client:Freeze(true)
self.Owner:setAction("Chopping", time, function()
ent:Remove()
nut.item.spawn("carparts", self:GetPos() + Vector(math.Rand(1,20), math.Rand(1,20),20), nil, Angle(0, 0, 0 ))
client:Freeze(false)
self.Owner:notify("You've chopped a car.")
end)
end
最初它是如果ent:GetModel()~=“models/mafia2/shubert_taxi.mdl”
并且运行良好,但是我想限制3个单独的模型。有人知道怎么做吗?您可以使用以下功能:
如果ent:IsVehicle()则
本地模型={“models/mafia2/shubert_taxi.mdl”、“models/mafia2/parry_bus.mdl”、“models/mafia2/smith_200_p_pha.mdl”}
--注意not关键字。
如果不是table.hasValue(models,ent:GetModel()),那么
....