As i said at the title i writed a code for setting playermodel to a prop but i dont know how to get user of a VGUI panel.
[CODE]if CLIENT then
local SpawnIcon1
local SpawnIcon1POOQ
local SpawnIcon1PCWH
local DPanel1
SpawnIcon1PCWH = vgui.Create('SpawnIcon')
SpawnIcon1PCWH:SetPos(290, 30)
DPanel1 = vgui.Create('DPanel')
DPanel1:SetSize(440, 120)
DPanel1:SetPos(120, 0)
SpawnIcon1POOQ = vgui.Create('SpawnIcon')
SpawnIcon1POOQ:SetParent(DPanel1)
SpawnIcon1POOQ:SetPos(90, 30)
SpawnIcon1 = vgui.Create('SpawnIcon')
SpawnIcon1:SetParent(DPanel1)
SpawnIcon1:SetPos(10, 30)
SpawnIcon1:SetModel("models/props_c17/column02a.mdl")
function SpawnIcon1:OnMousePressed()
plyuser:SetModel("models/props_c17/column02a.mdl")
end
end[/CODE]
Thanks for help it worked!
But there is a new problem;
I dont know how to open script on a players client without using "lua_openscript_cl"
Is there any way to do this in lua scripts ?
My current code
[CODE] if SERVER then
AddCSLuaFile ("server.lua")
concommand.Add("playermodel_set", function(ply, cmd, argStr)
if ply:GetUserGroup() == "superadmin" or ply:Team()==18 then ply:SetModel(argStr[1])
else ply:ChatPrint("You cant use this!") end
end)
end
if CLIENT then
local Frame = vgui.Create( "DFrame" )
Frame:SetTitle( "SELECT MODEL" )
Frame:SetSize( 600, 300 )
Frame:SetPos(200,100)
Frame:MakePopup()
Frame:SetDraggable( true )
Frame:ShowCloseButton( true )
Frame.Paint = function( self)
draw.RoundedBox( 0, 0, 0, 600, 300, Color( 0, 0, 0, 200 ) )
local SpawnI = vgui.Create("SpawnIcon")
SpawnI:SetPos(200,100)
SpawnI:SetParent(Frame)
SpawnI:SetModel("models/weapons/w_knife_ct.mdl")
SpawnI.DoClick = function()
SpawnI:Close()
RunConsoleCommand("playermodel_set","models/weapons/w_knife_ct.mdl")
Frame:Close()
end
end
end[/CODE]