Im working on a RP mod, but i have one problem. I want to create 4 fucntions.
[LIST]
[*]Create the menu
[*]Set text
[*]Options
[*]Close it
[/LIST]
I have a picture with a example on how i want it.
Ive made the menu i just want to know, how you remove the previous buttons (options)
[IMG]http://i45.tinypic.com/5l14at.jpg[/IMG]
Cant you just make the exact same frame and all, but without those buttons?
[editline]01:33PM[/editline]
btw, you spelled [b]Chief[/b] wrong
its how i will do it. but when im going to create a new frame the buttons will not be removed, since they are already created.
Is there a command to remove them?
... make a [b]new frame[/b]
Make a new frame with different options.
Doesent hide the buttons.
[editline]arw[/editline]
You edited your post. :smug: ^
@Dave_Parker FYI copyright is just protecting people from stealing your work. you can create your own if you want to. So this has nothing to do with Copyright...
nvm i got a idea on how to fix it
Seriously though, sintwin was right, I think.
Cant you set Button1:SetVisible(false)?
[QUOTE=Busymonkey;22101232]Seriously though, sintwin was right, I think.
Cant you set Button1:SetVisible(false)?[/QUOTE]
:) I think you can, it's worth a try.
Yea, your post got me thinking. But you wrote DermaFrame:SetVisible, so it wouldnt do anything else than just closing the whole Frame and it's "Children".
Well I just wrote the DermaFrame as an example to be changed, but he could just use it to close that frame and then make a new one with different buttons.
Yea, that's what I suggested at first post; just opening a new Frame with same position, height, width and all that, but without making the buttons.
Since your trying to make a system like perp has then why not just take a look in the perp code
hunts makes a VGUI element
[lua]
local PANEL = {};
surface.CreateFont("Tahoma", 17, 1000, true, false, "HUDFont")
function PANEL:Init ( )
local W, H = 500, 200;
self:SetSize(W, H);
self:SetPos(ScrW() * .5 - W * .5, ScrH() * .875 - H);
self:SetAlpha(0);
self.TalkArea = vgui.Create("DPanelList", self);
self.TalkArea:EnableHorizontal(false)
self.TalkArea:EnableVerticalScrollbar(true)
self.TalkArea:SetPadding(5);
self.TalkBubble = vgui.Create("DPanelList", self);
self.TalkBubble:EnableHorizontal(false)
self.TalkBubble:EnableVerticalScrollbar(true)
self.Responses = vgui.Create("DPanelList", self);
self.Responses:EnableHorizontal(false)
self.Responses:EnableVerticalScrollbar(true)
self.Responses:SetPadding(5);
self.OurText = {};
self.OurResponses = {};
end
function PANEL:PerformLayout ( )
self.TalkArea:SetPos(5, 5);
self.TalkArea:SetSize(self:GetWide() - 10, (self:GetTall() - 15) * .5);
self.TalkBubble:SetPos(5, (self:GetTall() - 15) * .5 + 10);
self.TalkBubble:SetSize((self:GetTall() - 15) * .5, (self:GetTall() - 15) * .5);
self.Responses:SetPos(((self:GetTall() - 15) * .5) + 10, (self:GetTall() - 15) * .5 + 10);
self.Responses:SetSize(self:GetWide() - ((self:GetTall() - 15) * .5) - 15, (self:GetTall() - 15) * .5);
end
function PANEL:Paint ( )
draw.RoundedBox(4, 0, 0, self:GetWide(), self:GetTall(), Color(100, 100, 100, 255));
end
function PANEL:AddText ( Text )
local NewLabel = vgui.Create('DLabel');
NewLabel:SetText(Text);
NewLabel:SizeToContents();
self.TalkArea:AddItem(NewLabel);
table.insert(self.OurText, NewLabel);
end
function PANEL:WipeText ( )
for k, v in pairs(self.OurText) do
v:Remove();
end
end
function PANEL:AddOption ( Text, Function )
local NewLabel = vgui.Create('DButton');
NewLabel:SetText(Text);
NewLabel.DoClick = Function;
self.Responses:AddItem(NewLabel);
table.insert(self.OurResponses, NewLabel);
end
function PANEL:AddSkinOption ( Text, TodoColor, Function, Ga )
local NewLabel = vgui.Create('perp_car_skin');
NewLabel:DoSetup(Text, TodoColor, Function, Ga);
self.Responses:AddItem(NewLabel);
table.insert(self.OurResponses, NewLabel);
end
function PANEL:WipeOptions ( )
for k, v in pairs(self.OurResponses) do
v:Remove();
end
end
function PANEL:Wipe ( )
self:WipeText();
self:WipeOptions();
self.Responses:Clear();
self.TalkArea:Clear();
end
function PANEL:SetModel ( OurModel )
if self.ModelPanel then self.ModelPanel:Remove(); end
self.ModelPanel = vgui.Create('DModelPanel', self);
self.ModelPanel:SetModel(OurModel);
if LocalPlayer():GetSex() == SEX_FEMALE then
self.ModelPanel:SetCamPos(Vector(14, 0, 60))
self.ModelPanel:SetLookAt(Vector(-1, 0, 64))
self.ModelPanel:SetFOV(70)
self.ModelPanel.Entity:SetColor(255, 255, 255, 0)
else
self.ModelPanel:SetCamPos(Vector(14, 0, 62))
self.ModelPanel:SetLookAt(Vector(-1, 0, 66))
self.ModelPanel:SetFOV(70)
self.ModelPanel.Entity:SetColor(255, 255, 255, 0)
end
self.OurText = {};
self.OurResponses = {};
function self.ModelPanel:LayoutEntity( Entity ) self:RunAnimation() end
local iSeq = self.ModelPanel.Entity:LookupSequence('idle_angry');
self.ModelPanel.Entity:ResetSequence(iSeq);
self.ModelPanel:SetPos(5, (self:GetTall() - 15) * .5 + 10);
self.ModelPanel:SetSize((self:GetTall() - 15) * .5, (self:GetTall() - 15) * .5);
end
vgui.Register('perp_talk', PANEL);
function GM.CloseTalk ( )
GAMEMODE.VGUI.Talk:SetVisible(false);
GAMEMODE.VGUI.Talk:SetAlpha(0);
GAMEMODE.VGUI.Talk.ModelPanel:Remove();
gui.EnableScreenClicker(false);
end
function GM.ShowTalk ( Model )
GAMEMODE.VGUI.Talk:SetVisible(true);
GAMEMODE.VGUI.Talk:SetAlpha(255);
GAMEMODE.VGUI.Talk:MakePopup();
if file.Exists('models/players/humans/group01/' .. LocalPlayer():GetShortModel()) then
GAMEMODE.VGUI.Talk:SetModel('models/players/humans/group01/' .. LocalPlayer():GetShortModel());
else
GAMEMODE.VGUI.Talk:SetModel(LocalPlayer():GetModel());
end
end
[/lua]
Then an example of usage
[lua]
local function Talk02 ( )
GAMEMODE.CloseTalk();
RunConsoleCommand('perp_qf');
end
local function Talk01 ( )
GAMEMODE.VGUI.Talk:Wipe();
local PoliceNumber = team.NumPlayers(TEAM_FIREMAN);
if PoliceNumber >= GAMEMODE.MaximumFireMen then
GAMEMODE.VGUI.Talk:AddText("We aren't currently recruiting new firefighters. Sorry.\n\n( This class is full. Try again later. )");
GAMEMODE.VGUI.Talk:AddOption("Alright. I'll check back in later, then.", GAMEMODE.CloseTalk);
elseif LocalPlayer():GetPlayTime() < GAMEMODE.RequiredTime_Fire * 60 * 60 and LocalPlayer():GetLevel() > 4 then
GAMEMODE.VGUI.Talk:AddText("Sorry, but it appears that you are not qualified for this position.\n\n( You need at least five hours of play time or VIP to be an officer. )");
GAMEMODE.VGUI.Talk:AddOption("Alright. I'll check back in later, then.", GAMEMODE.CloseTalk);
elseif GAMEMODE.IsRunningForMayor then
GAMEMODE.VGUI.Talk:AddText("You seem like the business type, are you sure you don't have other things going?\n\n( You cannot be a fire fighter while running for mayor. )");
GAMEMODE.VGUI.Talk:AddOption("Ahh, yes. I wouldn't have the time.", GAMEMODE.CloseTalk);
else
GAMEMODE.VGUI.Talk:AddText("Ahh, yes. Of course! Thank you for coming by! We've been looking to hire more men.\n\n( If you abuse your new-found power, you will be blacklisted and possibly banned. )");
RunConsoleCommand('perp_jf');
GAMEMODE.VGUI.Talk:AddOption("Thank you. I will do my hardest to protect the city.", GAMEMODE.CloseTalk);
end
end
local function Start ( )
GAMEMODE.ShowTalk();
GAMEMODE.VGUI.Talk:Wipe();
if LocalPlayer():Team() == TEAM_POLICE or LocalPlayer():Team() == TEAM_PARAMEDIC then
GAMEMODE.VGUI.Talk:AddText("Hello.");
GAMEMODE.VGUI.Talk:AddOption("Hello.", GAMEMODE.CloseTalk);
elseif LocalPlayer():Team() == TEAM_MAYOR then
GAMEMODE.VGUI.Talk:AddText("Hello, Mr. Mayor.");
GAMEMODE.VGUI.Talk:AddOption("Good day, sir.", GAMEMODE.CloseTalk);
elseif LocalPlayer():Team() == TEAM_FIREMAN then
GAMEMODE.VGUI.Talk:AddText("Hello.");
GAMEMODE.VGUI.Talk:AddOption("I'm here to quit the team. It's more than I can handle.", Talk02);
GAMEMODE.VGUI.Talk:AddOption("Hello.", GAMEMODE.CloseTalk);
else
GAMEMODE.VGUI.Talk:AddText("Hello.");
GAMEMODE.VGUI.Talk:AddOption("I'm interested in a position as a firefighter.", Talk01);
GAMEMODE.VGUI.Talk:AddOption("Hello.", GAMEMODE.CloseTalk);
end
end
GM:RegisterTalk('fire_hire', Start);
[/lua]
Of course I take no credit for that and I hope you dont rip it directly but read it and learn from it but that should show you exactly how to do it
well ive tried it but its many variables that isnt defined in does files.
So im making my own and i think i know how
Sorry, you need to Log In to post a reply to this thread.