I was wondering, I have been trying to create a spawnicon that sets the model of the person in the game. And so when I started with this I thought that I couldn't use any serverside functions (obviously because it is in the cl_init.lua file), So I created a console command to do it in the serverside lua files, and just call it in the cl_init.lua file)
So Basically, on my serverside files i have a table of all the models, and then on the clientside i do,
RunConsoleCommand("setmodels", selection)
and so in the serverside it calls:
ply:SetModel(models[selection])...
And to my point, I was wondering, is there a variable for the triggering player? Because I don't quite know what to do in that situation.
[url]http://wiki.garrysmod.com/?title=Concommand.Add[/url]
Here's how it should go : [lua]
//Server//
function SetTheModel(ply,command,args)
ply:SetModel(models[args[1]])
end
concommand.Add("setmodels", SetTheModel)
//Client//
RunConsoleCommand("setmodels", selection)[/lua]
Sorry, you need to Log In to post a reply to this thread.