I have 2 problems and i need help. So... The first problem. I have jobs and shipment. When i click on the job "Gun Dealer" (button) i need to reload my Derma. Why? If i will not reload my Derma, i will not see shipments. But
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
gui.EnableScreenClicker( false )
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
end
It doesn't work.
And the second problem. If i click on the button "Shipment" I have shipments, but i have a lot of dealers jobs.... and... how to sort shipments?
VIDEO:
https://www.youtube.com/watch?v=WC9VSK6X9-Y&feature=youtu.be
local jobpage = vgui.Create("DScrollPanel", page)
jobpage:Dock(FILL)
jobpage.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Job", jobpage, "icon16/application_xp_terminal.png")
for k,v in pairs(RPExtraTeams) do
local jobsspace = vgui.Create("DPanel", jobpage)
jobsspace:Dock(TOP)
jobsspace:SetSize(0,200)
jobsspace:DockMargin(5,5,5,5)
jobsspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
local names = vgui.Create("DLabel",jobsspace)
names:SetText(v.name)
names:Dock(TOP)
names:DockMargin(5,5,0,0)
names:SetSize(0,20)
names:SetFont("Trebuchet24")
names:SetTextColor(Color(255,255,255))
names:SetExpensiveShadow(2,Color(75,75,75,200))
if util.IsValidModel(v.model[1]) then
local MAvatar = vgui.Create("SpawnIcon",jobsspace)
MAvatar:Dock(LEFT)
MAvatar:SetSize(150,50)
MAvatar:DockMargin(5,5,5,5)
MAvatar:SetModel(v.model[1])
else
local MAvatar = vgui.Create("SpawnIcon",jobsspace)
MAvatar:Dock(LEFT)
MAvatar:SetSize(150,50)
MAvatar:DockMargin(5,5,5,5)
MAvatar:SetModel(v.model)
end
local InfPanel = vgui.Create("DPanel",jobsspace)
InfPanel:Dock(FILL)
InfPanel:SetSize(0,150)
InfPanel:DockMargin(5,5,5,5)
InfPanel.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet18")
local desX,desY = surface.GetTextSize(v.description)
local description = vgui.Create("DLabel",InfPanel)
description:SetText(v.description)
description:Dock(TOP)
description:DockMargin(5,5,5,5)
description:SetSize(desX,desY)
description:SetFont("Trebuchet18")
description:SetTextColor(Color(255,255,255))
description:SetExpensiveShadow(2,Color(75,75,75,200))
local chbutton = vgui.Create("DButton",jobsspace)
chbutton:SetText("Become Job")
chbutton:SetSize(75,25)
chbutton:Dock(BOTTOM )
chbutton:DockMargin(5,5,5,5)
chbutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
gui.EnableScreenClicker( false )
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
end
end
--Item/Shipment
local shipmentarea = vgui.Create("DScrollPanel", page)
shipmentarea:Dock(FILL)
shipmentarea.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Shipments", shipmentarea, "icon16/application_xp_terminal.png")
local ply = LocalPlayer()
if ply:Team() == TEAM_GUN then
local shspace = vgui.Create("DPanel", shipmentarea)
shspace:Dock(TOP)
shspace:SetSize(0,200)
shspace:DockMargin(5,5,5,5)
shspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
local shprice = vgui.Create("DLabel",shspace)
shprice:SetText("Shipments")
shprice:Dock(FILL)
shprice:DockMargin(5,0,0,0)
shprice:SetFont("DermaLarge")
shprice:SetTextColor(Color(255,255,255))
shprice:SetExpensiveShadow(2,Color(75,75,75,200))
for k,v in pairs(CustomShipments) do
if(v.noship == false) then
local shipspace = vgui.Create("DPanel", shipmentarea)
shipspace:Dock(TOP)
shipspace:SetSize(0,160)
shipspace:DockMargin(5,5,5,5)
shipspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,120)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet24")
local shnameX, shnameY = surface.GetTextSize(v.name)
local shipnames = vgui.Create("DLabel",shipspace)
shipnames:SetText(v.name)
shipnames:Dock(TOP)
shipnames:DockMargin(5,5,0,0)
shipnames:SetSize(shnameX,shnameY)
shipnames:SetFont("Trebuchet24")
shipnames:SetTextColor(Color(255,255,255))
shipnames:SetExpensiveShadow(2,Color(75,75,75,200))
local ShAvatar = vgui.Create("SpawnIcon",shipspace)
ShAvatar:Dock(LEFT)
ShAvatar:SetSize(150,150)
ShAvatar:DockMargin(5,5,5,5)
ShAvatar:SetModel(v.model)
surface.SetFont("Trebuchet24")
local shmaxriceX, shmaxriceY = surface.GetTextSize("Amount: ".. v.amount)
local Shippprice = vgui.Create("DLabel",shipspace)
Shippprice:SetText("Amount: " .. DarkRP.formatMoney(v.amount))
Shippprice:Dock(TOP)
Shippprice:DockMargin(5,5,0,0)
Shippprice:SetSize(shmaxriceX,shmaxriceY)
Shippprice:SetFont("Trebuchet24")
Shippprice:SetTextColor(Color(255,255,255))
Shippprice:SetExpensiveShadow(2,Color(75,75,75,200))
local shbutton = vgui.Create("DButton",shipspace)
shbutton:SetText("Become Job")
shbutton:SetSize(75,25)
shbutton:Dock(BOTTOM )
shbutton:DockMargin(5,5,5,5)
shbutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
shbutton.DoClick = function()
RunConsoleCommand("say","/buyshipment " .. v.name)
end
end
end
end
ALL CODE
local PANEL = {
Init = function(self)
self:SetSize(1000,720)
self:Center()
self:SetVisible(true)
local x,y = self:GetSize()
surface.SetFont("DermaLarge")
local titleX,titleY = surface.GetTextSize("IsRP")
local title = vgui.Create("DLabel", self)
title:SetText("IsRP")
title:SetSize(titleX,titleY)
title:SetPos(6,6)
title:SetFont("DermaLarge")
title:SetTextColor(Color(255,255,255,255))
title:SetExpensiveShadow(2,Color(75,75,75,200))
local closebutton = vgui.Create("DButton",self)
closebutton:SetSize(75,25)
closebutton:SetText(" ")
closebutton:SetPos(x-81,6)
closebutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
closebutton.DoClick = function()
CSF4Menu:SetVisible(false)
gui.EnableScreenClicker(false)
end
local reloadbutton = vgui.Create("DButton",self)
reloadbutton:SetSize(75,25)
reloadbutton:SetText(" ")
reloadbutton:SetPos(x-162,6)
reloadbutton.Paint = function (self,w,h)
surface.SetDrawColor(253,189,62,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(224,161,50,255)
surface.DrawOutlinedRect(0,0,w,h)
end
reloadbutton.DoClick = function()
CSF4Menu:Remove();
CSF4Menu = vgui.Create("cs_f4_menu")
end
local leftpan = vgui.Create("DPanel",self)
leftpan:SetPos(6,37)
leftpan:SetSize(x-12,y-43)
leftpan.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
local page = vgui.Create("CSDColumnSheet",leftpan)
page:Dock(FILL)
local mainpage = vgui.Create("DPanel", page)
mainpage:Dock(FILL)
mainpage.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Main", mainpage, "icon16/user.png")
--Jobs
local jobpage = vgui.Create("DScrollPanel", page)
jobpage:Dock(FILL)
jobpage.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Job", jobpage, "icon16/application_xp_terminal.png")
for k,v in pairs(RPExtraTeams) do
local jobsspace = vgui.Create("DPanel", jobpage)
jobsspace:Dock(TOP)
jobsspace:SetSize(0,200)
jobsspace:DockMargin(5,5,5,5)
jobsspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
local names = vgui.Create("DLabel",jobsspace)
names:SetText(v.name)
names:Dock(TOP)
names:DockMargin(5,5,0,0)
names:SetSize(0,20)
names:SetFont("Trebuchet24")
names:SetTextColor(Color(255,255,255))
names:SetExpensiveShadow(2,Color(75,75,75,200))
if util.IsValidModel(v.model[1]) then
local MAvatar = vgui.Create("SpawnIcon",jobsspace)
MAvatar:Dock(LEFT)
MAvatar:SetSize(150,50)
MAvatar:DockMargin(5,5,5,5)
MAvatar:SetModel(v.model[1])
else
local MAvatar = vgui.Create("SpawnIcon",jobsspace)
MAvatar:Dock(LEFT)
MAvatar:SetSize(150,50)
MAvatar:DockMargin(5,5,5,5)
MAvatar:SetModel(v.model)
end
local InfPanel = vgui.Create("DPanel",jobsspace)
InfPanel:Dock(FILL)
InfPanel:SetSize(0,150)
InfPanel:DockMargin(5,5,5,5)
InfPanel.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet18")
local desX,desY = surface.GetTextSize(v.description)
local description = vgui.Create("DLabel",InfPanel)
description:SetText(v.description)
description:Dock(TOP)
description:DockMargin(5,5,5,5)
description:SetSize(desX,desY)
description:SetFont("Trebuchet18")
description:SetTextColor(Color(255,255,255))
description:SetExpensiveShadow(2,Color(75,75,75,200))
local chbutton = vgui.Create("DButton",jobsspace)
chbutton:SetText("Become Job")
chbutton:SetSize(75,25)
chbutton:Dock(BOTTOM )
chbutton:DockMargin(5,5,5,5)
chbutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
gui.EnableScreenClicker( false )
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
end
end
--OtherItems
local otherpagearea = vgui.Create("DScrollPanel", page)
otherpagearea:Dock(FILL)
otherpagearea.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Other", otherpagearea, "icon16/application_xp_terminal.png")
for k,v in pairs(DarkRPEntities) do
local shspace = vgui.Create("DPanel", otherpagearea)
shspace:Dock(TOP)
shspace:SetSize(0,200)
shspace:DockMargin(5,5,5,5)
shspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet24")
local onameX, onameY = surface.GetTextSize(v.name)
local othernames = vgui.Create("DLabel",shspace)
othernames:SetText(v.name)
othernames:Dock(TOP)
othernames:DockMargin(5,5,0,0)
othernames:SetSize(onameX,onameY)
othernames:SetFont("Trebuchet24")
othernames:SetTextColor(Color(255,255,255))
othernames:SetExpensiveShadow(2,Color(75,75,75,200))
local OAvatar = vgui.Create("SpawnIcon",shspace)
OAvatar:Dock(LEFT)
OAvatar:SetSize(150,50)
OAvatar:DockMargin(5,5,5,5)
OAvatar:SetModel(v.model)
surface.SetFont("Trebuchet24")
local opriceX, opriceY = surface.GetTextSize(v.name)
local otherprice = vgui.Create("DLabel",shspace)
otherprice:SetText("Price: " .. DarkRP.formatMoney(v.price))
otherprice:Dock(TOP)
otherprice:DockMargin(5,5,0,0)
otherprice:SetSize(opriceX,opriceY)
otherprice:SetFont("Trebuchet24")
otherprice:SetTextColor(Color(255,255,255))
otherprice:SetExpensiveShadow(2,Color(75,75,75,200))
local opbutton = vgui.Create("DButton",shspace)
opbutton:SetText("Become Job")
opbutton:SetSize(75,25)
opbutton:Dock(BOTTOM )
opbutton:DockMargin(5,5,5,5)
opbutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
opbutton.DoClick = function()
RunConsoleCommand("say","/" .. v.cmd)
end
end
--Item/Shipment
local shipmentarea = vgui.Create("DScrollPanel", page)
shipmentarea:Dock(FILL)
shipmentarea.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Shipments", shipmentarea, "icon16/application_xp_terminal.png")
local ply = LocalPlayer()
if ply:Team() == TEAM_GUN then
local shspace = vgui.Create("DPanel", shipmentarea)
shspace:Dock(TOP)
shspace:SetSize(0,200)
shspace:DockMargin(5,5,5,5)
shspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
local shprice = vgui.Create("DLabel",shspace)
shprice:SetText("Shipments")
shprice:Dock(FILL)
shprice:DockMargin(5,0,0,0)
shprice:SetFont("DermaLarge")
shprice:SetTextColor(Color(255,255,255))
shprice:SetExpensiveShadow(2,Color(75,75,75,200))
for k,v in pairs(CustomShipments) do
if(v.noship == false) then
local shipspace = vgui.Create("DPanel", shipmentarea)
shipspace:Dock(TOP)
shipspace:SetSize(0,160)
shipspace:DockMargin(5,5,5,5)
shipspace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,120)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet24")
local shnameX, shnameY = surface.GetTextSize(v.name)
local shipnames = vgui.Create("DLabel",shipspace)
shipnames:SetText(v.name)
shipnames:Dock(TOP)
shipnames:DockMargin(5,5,0,0)
shipnames:SetSize(shnameX,shnameY)
shipnames:SetFont("Trebuchet24")
shipnames:SetTextColor(Color(255,255,255))
shipnames:SetExpensiveShadow(2,Color(75,75,75,200))
local ShAvatar = vgui.Create("SpawnIcon",shipspace)
ShAvatar:Dock(LEFT)
ShAvatar:SetSize(150,150)
ShAvatar:DockMargin(5,5,5,5)
ShAvatar:SetModel(v.model)
surface.SetFont("Trebuchet24")
local shmaxriceX, shmaxriceY = surface.GetTextSize("Amount: ".. v.amount)
local Shippprice = vgui.Create("DLabel",shipspace)
Shippprice:SetText("Amount: " .. DarkRP.formatMoney(v.amount))
Shippprice:Dock(TOP)
Shippprice:DockMargin(5,5,0,0)
Shippprice:SetSize(shmaxriceX,shmaxriceY)
Shippprice:SetFont("Trebuchet24")
Shippprice:SetTextColor(Color(255,255,255))
Shippprice:SetExpensiveShadow(2,Color(75,75,75,200))
local shbutton = vgui.Create("DButton",shipspace)
shbutton:SetText("Become Job")
shbutton:SetSize(75,25)
shbutton:Dock(BOTTOM )
shbutton:DockMargin(5,5,5,5)
shbutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
shbutton.DoClick = function()
RunConsoleCommand("say","/buyshipment " .. v.name)
end
end
end
end
--AmmoItems
local otherpagearea = vgui.Create("DScrollPanel", page)
otherpagearea:Dock(FILL)
otherpagearea.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
page:AddSheet("Ammo", otherpagearea, "icon16/application_xp_terminal.png")
for k,v in pairs(GAMEMODE.AmmoTypes) do
local ammospace = vgui.Create("DPanel", otherpagearea)
ammospace:Dock(TOP)
ammospace:SetSize(0,200)
ammospace:DockMargin(5,5,5,5)
ammospace.Paint = function (self,w,h)
surface.SetDrawColor(75,75,75,50)
surface.DrawRect(0,0,w,h)
end
surface.SetFont("Trebuchet24")
local onameX, onameY = surface.GetTextSize(v.name)
local ammonames = vgui.Create("DLabel",ammospace)
ammonames:SetText(v.name)
ammonames:Dock(TOP)
ammonames:DockMargin(5,5,0,0)
ammonames:SetSize(onameX,onameY)
ammonames:SetFont("Trebuchet24")
ammonames:SetTextColor(Color(255,255,255))
ammonames:SetExpensiveShadow(2,Color(75,75,75,200))
local AOAvatar = vgui.Create("SpawnIcon",ammospace)
AOAvatar:Dock(LEFT)
AOAvatar:SetSize(150,50)
AOAvatar:DockMargin(5,5,5,5)
AOAvatar:SetModel(v.model)
surface.SetFont("Trebuchet24")
local opriceX, opriceY = surface.GetTextSize(v.name)
local ammoprice = vgui.Create("DLabel",ammospace)
ammoprice:SetText("Price: " .. DarkRP.formatMoney(v.price))
ammoprice:Dock(TOP)
ammoprice:DockMargin(5,5,0,0)
ammoprice:SetSize(opriceX,opriceY)
ammoprice:SetFont("Trebuchet24")
ammoprice:SetTextColor(Color(255,255,255))
ammoprice:SetExpensiveShadow(2,Color(75,75,75,200))
local ammobutton = vgui.Create("DButton",ammospace)
ammobutton:SetText("Become Job")
ammobutton:SetSize(75,25)
ammobutton:Dock(BOTTOM )
ammobutton:DockMargin(5,5,5,5)
ammobutton.Paint = function (self,w,h)
surface.SetDrawColor(252,86,82,255)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(223,68,65,255)
surface.DrawOutlinedRect(0,0,w,h)
end
ammobutton.DoClick = function()
RunConsoleCommand("say","/buyammo " .. k)
end
end
end,
Paint = function(self, w, h)
surface.SetDrawColor(255,255,255,150)
surface.DrawRect(0,0,w,h)
surface.DrawOutlinedRect(2,2,w-4,h-4)
end
}
vgui.Register("cs_f4_menu", PANEL)
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
I might just be an idiot, but aren't you just making the frame invisible by doing this? You can't see it if it's hidden
How? If i click on the button once
CSF4Menu:SetVisible( false )
what do you expect this to do logically thinking
These are the sort of things that make me wonder why you aren't unbanned yet.
sorry if i'm sounding like an asshole. I genuinely don't know if I'm just an idiot or not. I don't know how DarkRP works so for all I know SetVisible could do something completely different
If delete
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
CMD says
[ERROR] addons/mchromef4menu/lua/autorun/mchromef4.lua:24: Tried to use invalid object (type Panel) (Object was NULL or not of the right type)
1. SetVisible - [C]:-1
2. func - addons/mchromef4menu/lua/autorun/mchromef4.lua:24
3. unknown - lua/includes/extensions/net.lua:32
mchromef4.lua
if SERVER then
AddCSLuaFile("vgui/cs_f4_menu.lua")
util.AddNetworkString( "f4menu" )
hook.Add("ShowSpare2","F4MenuHook",function(ply)
net.Start("f4menu")
net.Send(ply)
end)
end
if CLIENT then
include("vgui/cs_f4_menu.lua")
net.Receive("f4menu", function()
if(!CSF4Menu) then
CSF4Menu = vgui.Create("cs_f4_menu")
CSF4Menu:SetVisible(false)
end
if(CSF4Menu:IsVisible()) then
CSF4Menu:SetVisible(false)
gui.EnableScreenClicker(false)
else
CSF4Menu:SetVisible(true)
gui.EnableScreenClicker(true)
end
end)
end
I don't mean to delete the line creating the menu, just the line HIDING the menu:
CSF4Menu:SetVisible( false )
Try just deleting this one line. It sets the visibility to false, meaning it is not visible.
If you remove that line and that line only, then the panel should obviously be visible.
Ok.. so... now i have it
https://www.youtube.com/watch?v=sjzojjwPy04&feature=youtu.be
My button works if i click on it and i have job delay
I don't see the problem, you didn't program a delay thing to verify if you can press on the button, but grab the join button and add into a var CurTime() + joinCooldown and then inside join button add an if checking if that number you took recently is smaller than current CurTime()
No offense, but that's the kind of stuff you should think in your side
Right?
local delay = 2
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
gui.EnableScreenClicker( false )
if CurTime() < delay then
return
else
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
end
end
I am newbie
Don't use a delay, use the DarkRP hook https://wiki.darkrp.com/index.php/Hooks/Shared/OnPlayerChangedTeam
When the team is changed, if CSF4Menu is a valid panel, remove and create.
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
end
function reloadDerma ( ply, oldteam, newteam )
if ( newteam == TEAM_GUN ) then
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
else
print("Nope")
end
hook.Add("OnPlayerChangedTeam", "onoff", reloadDerma)
Like this?
CMD says error
unexpected symbol near ','
line - 378
end,
Don't add a hook every time the function is called. You might want to make sure you understand how hooks work before trying to code anything else. hook.Add
Just go to line 138 and use your brain. How am I supposed to know why there's a comma there?
You forgot to close the function, before "hook.Add" you want an end:
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
end
function reloadDerma ( ply, oldteam, newteam )
if ( newteam == TEAM_GUN ) then
gui.EnableScreenClicker( false )
CSF4Menu:Remove()
CSF4Menu = vgui.Create( "cs_f4_menu" )
CSF4Menu:SetVisible( false )
else
print("Nope")
end
end
hook.Add("OnPlayerChangedTeam", "onoff", reloadDerma)
Thx. But that what i wanted doesn't work
Why are you doing CSF4Menu:SetVisible(false) immediately after you recreate it?
Anyway vgui doesn't reload
https://files.facepunch.com/forum/upload/114477/6f39015b-2ada-4eb5-b489-7c457a25e1f7/изображение.png
chbutton.DoClick = function()
RunConsoleCommand( "say", "/" .. v.command )
print( "I was clicked!" )
function reloadDerma ( ply, oldteam, newteam )
if ( newteam == TEAM_GUN ) then
print( "I was CLICKEDDD!" )
CSF4Menu:Remove();
CSF4Menu = vgui.Create("cs_f4_menu")
else
print("Nope")
end
end
hook.Add("OnPlayerChangedTeam", "onoff", reloadDerma)
end
These two lines don't work
CSF4Menu:Remove();
CSF4Menu = vgui.Create("cs_f4_menu")
but
print( "I was CLICKEDDD!" )
Works!
Thx. I just made it other.
Dont add the hook on button click
I fixed it =)) But know i don't know how to make sorting.
Sorry, you need to Log In to post a reply to this thread.