How do i post the coding into this? So i can upload the code
Post your code wrapped in lua tags, so [ lua ] CODE [ /lua ] without the spaces.
What you mean?
Type [ lua ] without spaces, paste your code then type [ /lua ] without spaces.
Hard not to understand? :dance:
[lua][ERROR] gamemodes/darkrp/gamemode/client/vgui.lua:1039: attempt to concatenate global 'CUR' (a nil value)
1. Refresh - gamemodes/darkrp/gamemode/client/vgui.lua:1039
2. OpenTab - gamemodes/darkrp/gamemode/client/vgui.lua:487
3. DoClick - gamemodes/darkrp/gamemode/client/vgui.lua:970
4. unknown - lua/vgui/dlabel.lua:206
[/lua]
[editline]18th January 2014[/editline]
another error is [lua]Couldn't include file 'client\vgui.lua' (File not found) <@gamemodes/darkrp/game
mode/cl_init.lua (line 69))[/lua]
We need to see the code before we can help you.
Second error means the file cannot be sent to the client because it is not there or the path is misspelled.
[QUOTE=CR7;43576992][lua][ERROR] gamemodes/darkrp/gamemode/client/vgui.lua:1039: attempt to concatenate global 'CUR' (a nil value)
1. Refresh - gamemodes/darkrp/gamemode/client/vgui.lua:1039
2. OpenTab - gamemodes/darkrp/gamemode/client/vgui.lua:487
3. DoClick - gamemodes/darkrp/gamemode/client/vgui.lua:970
4. unknown - lua/vgui/dlabel.lua:206
[/lua]
[editline]18th January 2014[/editline]
another error is [lua]Couldn't include file 'client\vgui.lua' (File not found) <@gamemodes/darkrp/game
mode/cl_init.lua (line 69))[/lua][/QUOTE]
So, open garrysmod/gamemodes/darkrp/gamemode/client/vgui.lua and post all of your code or just add
[lua]CUR = $[/lua] in cl_init.lua
[lua]local VoteVGUI = {}
local QuestionVGUI = {}
local PanelNum = 0
local LetterWritePanel
local function MsgDoVote(msg)
local _, chatY = chat.GetChatBoxPos()
local question = msg:ReadString()
local voteid = msg:ReadShort()
local timeleft = msg:ReadFloat()
if timeleft == 0 then
timeleft = 100
end
local OldTime = CurTime()
if not IsValid(LocalPlayer()) then return end -- Sent right before player initialisation
LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100)
local panel = vgui.Create("DFrame")
panel:SetPos(3 + PanelNum, chatY - 145)
panel:SetTitle("Vote")
panel:SetSize(140, 140)
panel:SetSizable(false)
panel.btnClose:SetVisible(false)
panel:SetDraggable(false)
function panel:Close()
PanelNum = PanelNum - 140
VoteVGUI[voteid .. "vote"] = nil
local num = 0
for k,v in SortedPairs(VoteVGUI) do
v:SetPos(num, ScrH() / 2 - 50)
num = num + 140
end
for k,v in SortedPairs(QuestionVGUI) do
v:SetPos(num, ScrH() / 2 - 50)
num = num + 300
end
self:Remove()
end
function panel:Think()
self:SetTitle("Time: ".. tostring(math.Clamp(math.ceil(timeleft - (CurTime() - OldTime)), 0, 9999)))
if timeleft - (CurTime() - OldTime) <= 0 then
panel:Close()
end
end
panel:SetKeyboardInputEnabled(false)
panel:SetMouseInputEnabled(true)
panel:SetVisible(true)
for i = 22, string.len(question), 22 do
if not string.find(string.sub(question, i - 20, i), "\n", 1, true) then
question = string.sub(question, 1, i) .. "\n".. string.sub(question, i + 1, string.len(question))
end
end
local label = vgui.Create("DLabel")
label:SetParent(panel)
label:SetPos(5, 25)
label:SetText(question)
label:SizeToContents()
label:SetVisible(true)
local nextHeight = label:GetTall() > 78 and label:GetTall() - 78 or 0 // make panel taller for divider and buttons
panel:SetTall(panel:GetTall() + nextHeight)
local divider = vgui.Create("Divider")
divider:SetParent(panel)
divider:SetPos(2, panel:GetTall() - 30)
divider:SetSize(180, 2)
divider:SetVisible(true)
local ybutton = vgui.Create("Button")
ybutton:SetParent(panel)
ybutton:SetPos(25, panel:GetTall() - 25)
ybutton:SetSize(40, 20)
ybutton:SetCommand("!")
ybutton:SetText("Yes")
ybutton:SetVisible(true)
ybutton.DoClick = function()
LocalPlayer():ConCommand("vote " .. voteid .. " yea\n")
panel:Close()
end
local nbutton = vgui.Create("Button")
nbutton:SetParent(panel)
nbutton:SetPos(70, panel:GetTall() - 25)
nbutton:SetSize(40, 20)
nbutton:SetCommand("!")
nbutton:SetText("No")
nbutton:SetVisible(true)
nbutton.DoClick = function()
LocalPlayer():ConCommand("vote " .. voteid .. " nay\n")
panel:Close()
end
PanelNum = PanelNum + 140
VoteVGUI[voteid .. "vote"] = panel
panel:SetSkin(GAMEMODE.Config.DarkRPSkin)
end
usermessage.Hook("DoVote", MsgDoVote)
local function KillVoteVGUI(msg)
local id = msg:ReadShort()
if VoteVGUI[id .. "vote"] and VoteVGUI[id .. "vote"]:IsValid() then
VoteVGUI[id.."vote"]:Close()
end
end
usermessage.Hook("KillVoteVGUI", KillVoteVGUI)
local function MsgDoQuestion(msg)
local question = msg:ReadString()
local quesid = msg:ReadString()
local timeleft = msg:ReadFloat()
if timeleft == 0 then
timeleft = 100
end
local OldTime = CurTime()
LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100)
local panel = vgui.Create("DFrame")
panel:SetPos(3 + PanelNum, ScrH() / 2 - 50)--Times 140 because if the quesion is the second screen, the first screen is always a vote screen.
panel:SetSize(300, 140)
panel:SetSizable(false)
panel.btnClose:SetVisible(false)
panel:SetKeyboardInputEnabled(false)
panel:SetMouseInputEnabled(true)
panel:SetVisible(true)
function panel:Close()
PanelNum = PanelNum - 300
QuestionVGUI[quesid .. "ques"] = nil
local num = 0
for k,v in SortedPairs(VoteVGUI) do
v:SetPos(num, ScrH() / 2 - 50)
num = num + 140
end
for k,v in SortedPairs(QuestionVGUI) do
v:SetPos(num, ScrH() / 2 - 50)
num = num + 300
end
self:Remove()
end
function panel:Think()
self:SetTitle("Time: ".. tostring(math.Clamp(math.ceil(timeleft - (CurTime() - OldTime)), 0, 9999)))
if timeleft - (CurTime() - OldTime) <= 0 then
panel:Close()
end
end
local label = vgui.Create("DLabel")
label:SetParent(panel)
label:SetPos(5, 30)
label:SetSize(380, 40)
label:SetText(question)
label:SetVisible(true)
local divider = vgui.Create("Divider")
divider:SetParent(panel)
divider:SetPos(2, 80)
divider:SetSize(380, 2)
divider:SetVisible(true)
local ybutton = vgui.Create("DButton")
ybutton:SetParent(panel)
ybutton:SetPos(105, 100)
ybutton:SetSize(40, 20)
ybutton:SetText("Yes")
ybutton:SetVisible(true)
ybutton.DoClick = function()
LocalPlayer():ConCommand("ans " .. quesid .. " 1\n")
panel:Close()
end
local nbutton = vgui.Create("DButton")
nbutton:SetParent(panel)
nbutton:SetPos(155, 100)
nbutton:SetSize(40, 20)
nbutton:SetText("No")
nbutton:SetVisible(true)
nbutton.DoClick = function()
LocalPlayer():ConCommand("ans " .. quesid .. " 2\n")
panel:Close()
end
PanelNum = PanelNum + 300
QuestionVGUI[quesid .. "ques"] = panel
panel:SetSkin(GAMEMODE.Config.DarkRPSkin)
end
usermessage.Hook("DoQuestion", MsgDoQuestion)
local function KillQuestionVGUI(msg)
local id = msg:ReadString()
if QuestionVGUI[id .. "ques"] and QuestionVGUI[id .. "ques"]:IsValid() then
QuestionVGUI[id .. "ques"]:Close()
end
end
usermessage.Hook("KillQuestionVGUI", KillQuestionVGUI)
local function DoVoteAnswerQuestion(ply, cmd, args)
if not args[1] then return end
local vote = 0
if tonumber(args[1]) == 1 or string.lower(args[1]) == "yes" or string.lower(args[1]) == "true" then vote = 1 end
for k,v in pairs(VoteVGUI) do
if ValidPanel(v) then
local ID = string.sub(k, 1, -5)
VoteVGUI[k]:Close()
RunConsoleCommand("vote", ID, vote)
return
end
end
for k,v in pairs(QuestionVGUI) do
if ValidPanel(v) then
local ID = string.sub(k, 1, -5)
QuestionVGUI[k]:Close()
RunConsoleCommand("ans", ID, vote)
return
end
end
end
concommand.Add("rp_vote", DoVoteAnswerQuestion)
local function DoLetter(msg)
LetterWritePanel = vgui.Create("Frame")
LetterWritePanel:SetPos(ScrW() / 2 - 75, ScrH() / 2 - 100)
LetterWritePanel:SetSize(150, 200)
LetterWritePanel:SetMouseInputEnabled(true)
LetterWritePanel:SetKeyboardInputEnabled(true)
LetterWritePanel:SetVisible(true)
end
usermessage.Hook("DoLetter", DoLetter)
local F4Menu
local F4MenuTabs
local F4Tabs = {}
local hasReleasedF4 = false
function GM:addF4MenuTab(name, tabControl, icon)
return table.insert(F4Tabs, {name = name, ctrl = tabControl, icon = icon})
end
function GM:switchTabOrder(from, to)
F4Tabs[from], F4Tabs[to] = F4Tabs[to], F4Tabs[from]
end
function GM:removeTab(tabNr)
if ValidPanel(F4Tabs[tabNr].ctrl) then
F4Tabs[tabNr].ctrl:Remove()
end
table.remove(F4Tabs, tabNr)
end
local function ChangeJobVGUI()
if not F4Menu or not F4Menu:IsValid() then
F4Menu = vgui.Create("DFrame")
F4Menu:SetSize(770, 580)
F4Menu:Center()
F4Menu:SetVisible( true )
F4Menu:MakePopup()
F4Menu:SetTitle("Options menu")
GAMEMODE:addF4MenuTab("Money/Commands", GAMEMODE:MoneyTab(), "icon16/money.png")
GAMEMODE:addF4MenuTab("Jobs", GAMEMODE:JobsTab(), "icon16/user_suit.png")
GAMEMODE:addF4MenuTab("Entities/weapons", GAMEMODE:EntitiesTab(), "icon16/cart.png")
GAMEMODE:addF4MenuTab("HUD", GAMEMODE:RPHUDTab(), "icon16/camera.png")
hook.Call("F4MenuTabs", nil)
F4Menu:SetSkin(GAMEMODE.Config.DarkRPSkin)
else
F4Menu:SetVisible(true)
F4Menu:SetSkin(GAMEMODE.Config.DarkRPSkin)
end
hasReleasedF4 = false
function F4Menu:Think()
if input.IsKeyDown(KEY_F4) and hasReleasedF4 then
self:Close()
elseif not input.IsKeyDown(KEY_F4) then
hasReleasedF4 = true
end
if (!self.Dragging) then return end
local x = gui.MouseX() - self.Dragging[1]
local y = gui.MouseY() - self.Dragging[2]
x = math.C
Show us your addEntinties file
Sorry, you need to Log In to post a reply to this thread.