Hi guys, I need your help (player: spawn and vector)
3 replies, posted
Hi guys, I need your help (player: spawn and vector)
I can not understand how this function will work!
I need an answer:
1. (actions with teleport)
When you press the Dimagebutton the player teleports to the dot on the map.
2. How to make it so that when you move your mouse over the DImagebutton, this picture is highlighted in color.
CODE
function Fractiont()
local DermaFrame = vgui.Create( "DFrame" )
DermaFrame:SetTitle( "" )
DermaFrame:SetSize( 1920, 1080 )
DermaFrame:SetVisible( true )
DermaFrame:MakePopup()
DermaFrame:ShowCloseButton(false)
DermaFrame:Center()
DermaFrame.Paint = function()
draw.RoundedBox( 8, 0, 0, DermaFrame:GetWide(), DermaFrame:GetTall(), Color( 0, 0, 0, 150 ) )
end
sssr = vgui.Create( "DImageButton", DermaFrame )
sssr:SetPos( 0 , 0 ) -- // Set position
--DermaImageButton:SetSize( -100 , -1000 )
sssr:SetImage( "sssr1.png" ) --// Set the material - relative to /materials/ directory
sssr:SizeToContents() -- // OPTIONAL: Use instead of SetSize if you want to resize automatically ( without stretching )
sssr.DoClick = function()
DermaFrame:Remove()
RunConsoleCommand("say", "/baba")
end
sha = vgui.Create( "DImageButton", DermaFrame )
sha:SetPos( 0 , 270 ) -- // Set position
--DermaImageButton:SetSize( -100 , -1000 )
sha:SetImage( "sha1.png" ) --// Set the material - relative to /materials/ directory
sha:SizeToContents() -- // OPTIONAL: Use instead of SetSize if you want to resize automatically ( without stretching )
sha.DoClick = function()
DermaFrame:Remove()
RunConsoleCommand("say", "/baba")
end
germ = vgui.Create( "DImageButton", DermaFrame )
germ:SetPos( 0 , 555 ) -- // Set position
--DermaImageButton:SetSize( -100 , -1000 )
germ:SetImage( "germ1.png" ) --// Set the material - relative to /materials/ directory
germ:SizeToContents() -- // OPTIONAL: Use instead of SetSize if you want to resize automatically ( without stretching )
germ.DoClick = function()
DermaFrame:Remove()
RunConsoleCommand("say", "/baba")
end
uk = vgui.Create( "DImageButton", DermaFrame )
uk:SetPos( 0 , 825 ) -- // Set position
--DermaImageButton:SetSize( -100 , -1000 )
uk:SetImage( "uk1.png" ) --// Set the material - relative to /materials/ directory
uk:SizeToContents() -- // OPTIONAL: Use instead of SetSize if you want to resize automatically ( without stretching )
uk.DoClick = function()
DermaFrame:Remove()
RunConsoleCommand("say", "/baba")
end
end
RUS
Привет, ребята, мне нужна ваша помощь (игрок: spawn и vector)
Я не могу понять, как эта функция будет работать!
Мне нужен ответ:
1. (действия с телепортами)
Когда вы нажимаете кнопку Dimagebutton, игрок телепортируется в точку на карте.
2. Как сделать так, чтобы при перемещении мыши над кнопкой DImage это изображение выделено цветом.
Please wrap your code by selecting it all and clicking the curly braces (the {} at the bottom) when you're posting code.
Use SetPos. You'll need to store the destination somewhere (e.g. an array)
Try using IsHovered or OnCursorEntered and OnCursorExited
You're gonna need to network the button click to the server. For that, you can either use concommand.Add or the Net Library Usage.
Then do ply:SetPos(x,y) on the server.
Untested, but the general idea
Server
util.AddNetworkString("tpToPos")
net.Receive("tpToPos", function(len, pl)
if pl:IsValid() and pl:IsAdmin() then
pl:SetPos(Vector(0,0,0))
end
end)
Client
button.DoClick = function()
net.Start("tpToPos")
net.SendToServer()
end
Sorry, you need to Log In to post a reply to this thread.