Help trying to set body groups through lua using "cl_playerbodygroups"
4 replies, posted
So, as you can gather from the title, I am trying to set the bodygroups of a player from the command cl_playerbodygroups. Earlyer I was doing something similar with skins, using cl_playerskin. That seemed to work fine for skins...
[CODE] skin = math.random ( 0, 17) RunConsoleCommand("cl_playerskin", skin) [/CODE]
But when I attempted something similar with the cl_bodygroups command, I couldn't get the bodygroups to change
[CODE]concommand.Add( "testcommand", function(ply)
rna1 = math.random ( 0, 17)
rna2 = math.random ( 0, 17)
rna3 = math.random ( 0, 17)
rna4 = math.random ( 0, 2)
rna5 = math.random ( 0, 2)
rna6 = math.random ( 0, 1)
RunConsoleCommand("cl_playerbodygroups" , rna1 , rna2 , rna3 , rna4 , rna5 , rna6 ) print (rna1, rna2, rna3, rna4, rna5, rna6)
ply:Spawn()
end)[/CODE]
Can anybody tell me what I'm doing wrong here?
the format is cl_playerbodygroups "a b c"
Not cl_playerbodygroups "a" "b" "c" like you are giving it.
[QUOTE=Robotboy655;52108799]the format is cl_playerbodygroups "a b c"
Not cl_playerbodygroups "a" "b" "c" like you are giving it.[/QUOTE]
Thank you for replying; I tried your suggestion, but it appears that having any quotations marks around the variables will cause RunConsoleCommand to read the strings literally. Anything else I could try?
[QUOTE=Axon9000;52110277]Thank you for replying; I tried your suggestion, but it appears that having any quotations marks around the variables will cause RunConsoleCommand to read the strings literally. Anything else I could try?[/QUOTE]
I think he means you have to write all the parameters in a single argument, because RunConsoleCommand already separates the argument with quotation marks. Try this:
[CODE]RunConsoleCommand("cl_playerbodygroups" , rna1.." "..rna2.." "..rna3.." "..rna4.." "..rna5.." "..rna6 )[/CODE]
[QUOTE=MaxShadow;52110380]I think he means you have to write all the parameters in a single argument, because RunConsoleCommand already separates the argument with quotation marks. Try this:
[CODE]RunConsoleCommand("cl_playerbodygroups" , rna1.." "..rna2.." "..rna3.." "..rna4.." "..rna5.." "..rna6 )[/CODE][/QUOTE]
This worked perfectly, thank you both!
Sorry, you need to Log In to post a reply to this thread.