I want to do it so when the player presses the button it changes his playermodel.
How do i do that? I can't find anything helpful
[code]
local DButton = vgui.Create( "DButton", DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( "Join Blue Team" )
DButton:SetSize( 120, 60 )
DButton.DoClick = function( ply )
ply:SetModel( "models/humans/Group03/male_02.mdl" )
end
[/code]
I suppose it's something along the lines of this? I'm pretty new to this myself
[QUOTE=Kool Kids Klub;45327673][code]
local DButton = vgui.Create( "DButton", DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( "Join Blue Team" )
DButton:SetSize( 120, 60 )
DButton.DoClick = function( ply )
ply:SetModel( "models/humans/Group03/male_02.mdl" )
end
[/code]
I suppose it's something along the lines of this? I'm pretty new to this myself[/QUOTE]
SetModel needs to be called on the server, you would need to do some networking.
Fixed by using LocalPlayer():...
Actually it doesn't work on multiplayer, just singleplayer.
Any idea?
In a clientside file
[CODE]
local DButton = vgui.Create( "DButton", DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( "Join Blue Team" )
DButton:SetSize( 120, 60 )
DButton.DoClick = function( ply )
RunConsoleCommand("heytroll")
end
[/CODE]
In a serverside file
[CODE]
function heylol
ply:SetModel("models/humans/Group03/male_02.mdl")
end
concommand.Add("heytroll", heylol)[/CODE]
Dont use console commands when doing somthing like this. As people will learn them and then take advantage of them.
Speaking of which, does anyone know where I can find the player model directories to accomplish something like this?
Any other ideas? Using console is a problem because there's alot of items. Like what, i should create each command for an item?
Actually how do i add parameters (like the console "say" cmd)
local DButton = vgui.Create( "DButton", DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( "Join Blue Team" )
DButton:SetSize( 120, 60 )
DButton.DoClick = function() net.Start("plymodel") net.SendToServer() end
then server side:
util.AddNetworkString("plymodel")
net.Receive("plymodel", function()
LocalPlayer():SetModel("models/humans/Group03/male_02.mdl")
end )
untested and might not work, wrote this on hpone, correct me if im wrong
[QUOTE=Invule;45329873]local DButton = vgui.Create( "DButton", DPanel )
DButton:SetPos( 10, 270 )
DButton:SetText( "Join Blue Team" )
DButton:SetSize( 120, 60 )
DButton.DoClick = function() net.Start("plymodel") net.SendToServer() end
then server side:
util.AddNetworkString("plymodel")
net.Receive("plymodel", function()
LocalPlayer():SetModel("models/humans/Group03/male_02.mdl")
end )
untested and might not work, wrote this on hpone, correct me if im wrong[/QUOTE]
I have 17 items, what am i suppose to do? 17 commands?
[QUOTE=RedNinja;45329923]I have 17 items, what am i suppose to do? 17 commands?[/QUOTE]
17 models? Make a table?
[QUOTE=Invule;45329937]17 models? Make a table?[/QUOTE]
Too lazy. Isn't there another fix?
[IMG]http://i.imgur.com/jdrdXmW.png[/IMG]
also in the meanwhile
[QUOTE=RedNinja;45330018]Too lazy. Isn't there another fix[/QUOTE]
Making a table is probably the easiest to do,
local models = {
"model1",
"model2",
"model3"
}
Sorry, you need to Log In to post a reply to this thread.