ULX

Author Topic: Derma utime help :/  (Read 1902 times)

0 Members and 1 Guest are viewing this topic.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Derma utime help :/
« on: February 15, 2013, 08:39:30 AM »
Hello everyone, it's been a while since I've actually needed help but someone here may be able to help me more than I have to myself, so here to goes.
I used to have a script that allowed you to change the player's time using utime ofc in the middle of the game. It's all used to work on garry's mod 12, but just a few day's ago I tried to use it again and apparently DComboBox was changed to DMultiChoice. I've tried everything to get it to work again but I can't do it for my life. I'm also using Derma, because I don't understand GWEN... so yeah.
Code: [Select]
MainCheckbox = vgui.Create('DComboBox')
MainCheckbox:SetParent(MainFrame)
MainCheckbox:SetSize(221, 213)
MainCheckbox:SetPos(89, 48)
MainCheckbox:EnableHorizontal(false)
MainCheckbox:EnableVerticalScrollbar(true)
MainCheckbox:SetMultiple(false)
MainCheckbox:CenterHorizontal( )

local Players = player.GetAll()
for i = 1, table.Count(Players) do
local plyb = Players[i]
MainCheckbox:AddItem( plyb:Nick() )
end

function MainCheckbox:Think()
if (MainCheckbox:GetSelectedItems() and MainCheckbox:GetSelectedItems()[1]) then
if (MainCheckbox:GetSelectedItems()[1]:GetValue() ~= LastValue) then
local Players = player.GetAll()
for i = 1, table.Count(Players) do
local ply = Players[i]
if (MainCheckbox:GetSelectedItems() and MainCheckbox:GetSelectedItems()[1]) then
if (ply:Nick() == MainCheckbox:GetSelectedItems()[1]:GetValue()) then
w,d,h,m,s = timeToStrInd( ply:GetUTime() + CurTime() - ply:GetUTimeStart() )
CheckWeek:SetValue(w)
CheckDay:SetValue(d)
CheckHours:SetValue(h)
CheckMinutes:SetValue(m)
CheckSeconds:SetValue(s)
LastValue = ply:Nick()
end
end
end
end
end
end --function end


Code: [Select]
btnSetTime = vgui.Create('DButton')
btnSetTime:SetParent(MainFrame)
btnSetTime:SetSize(70, 25)
btnSetTime:SetPos(124, 363)
btnSetTime:SetText('Set Time')
btnSetTime.DoClick = function()
local w,d,h,m,s
local Players = player.GetAll()
for i = 1, table.Count(Players) do
local plya = Players[i]
if (MainCheckbox:GetSelectedItems() and MainCheckbox:GetSelectedItems()[1]) then
if (plya:Nick() == MainCheckbox:GetSelectedItems()[1]:GetValue()) then
local utply = plya
w = CheckWeek:GetValue()
d = CheckDay:GetValue()
h = CheckHours:GetValue()
m = CheckMinutes:GetValue()
s = CheckSeconds:GetValue()
amt = StrToTime(w,d,h,m,s)

require("datastream")
datastream.StreamToServer( "SendPly", { utply, amt } )
end
else
Errorlbl1:SetText('Please highlight a name before using this.')
ErrorFrame:MakePopup()
ErrorFrame:SetVisible( true )
end
end
end
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Derma utime help :/
« Reply #1 on: February 17, 2013, 07:42:26 PM »
Anyone have any suggestion ? :(
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.