[lua]
function addProperty(ply,name)
if(ply:IsAdmin()) then
local myEye=ply:GetEyeTrace()
if(myEye.Entity:GetClass()=="prop_door_rotating") then
myEye.Entity:SetVar("SetName",named)
end
end
end
concommand.Add("addProperty",addProperty)
function setPrice(ply,amt)
local myEye=ply:GetEyeTrace()
local setNamed=myEye.Entity:GetVar("SetName")
for k,v in pairs(ents.FindByClass("prop_door_rotating")) do
if(v:GetVar("SetName")==setNamed) then
v:SetVar("SetCost",amt)
end
end
end
concommand.Add("setPrice",setPrice)
[/lua]
So what I'm trying to do is that I'm trying to do these commands to set up real estate, but the issue is that I cannot get the arguments to pass right, even if I type something in like "addProperty Walrus" in console, instead it sets the name as the function. Anybody know the problem?
There are 3 arguments to concommands, the player who ran it, the command name, and a table of arguments. You'd want the first argument.
[lua]
function ExampleConCommand(ply,cmd,args)
local name = args[1]
print(name)
end
concommand.Add("example",ExampleConCommand)
[/lua]
Typing "example foobar" would simply print "foobar" to the console.
[QUOTE=ralle105;25637638]There are 3 arguments to concommands, the player who ran it, the command name, and a table of arguments. You'd want the first argument.
[lua]
function ExampleConCommand(ply,cmd,args)
local name = args[1]
print(name)
end
concommand.Add("example",ExampleConCommand)
[/lua]
Typing "example foobar" would simply print "foobar" to the console.[/QUOTE]
Thanks, that helps. I'll contact you guys if I have more issues.
Sorry, you need to Log In to post a reply to this thread.