Well, Im making a gamemode and I get an error, even though Im sure it is right, so I need help.
[CODE]function buyEntity (ply, cmd, args)
if(args[1] !=nil) then
local ent = ent.Create(args[1])
local tr = ply:GetEyeTrace()
if(ent:IsVaild())then
local ClassName = ent:GetClass
if(!tr.Hit)then return end
local entCount = ply:GetNWInt(ClassName .. "count")
if(entCount < ent.Limit)then
local SpawnPos = ply:GetShootPos() + ply:GetForward() *80
ent.Owner = ply
local ent = ents.Create(ClassName)
ent:SetPos(SpawnPos)
ent:Spawn
ent:Activate
ply:SetNWInt(ClassName .. "count", entCount + 1)
return ent
end
return
end
end
end
concommand.Add("buy_entity", buyEntity)
[/CODE]
Error Message [CODE][ERROR] gamemodes/owc/gamemode/concommands.lua:9: function arguments expected near 'if'
1. unknown - gamemodes/owc/gamemode/concommands.lua:0
[/CODE]
I'm not an expert, but did you forget an end here?
[CODE]
if(ent:IsVaild())then
local ClassName = ent:GetClass
end -- Right here?
[/CODE]
Change
[code]
local ClassName = ent:GetClass
[/code]
to
[code]
local ClassName = ent:GetClass()
[/code]
You've done the same thing multiple times later on. If you want to call a function you must use () even if it has no arguments
Thanks!
Sorry, you need to Log In to post a reply to this thread.