ULX

Author Topic: Automatic Votemap  (Read 16141 times)

0 Members and 1 Guest are viewing this topic.

Offline DrTight

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
Automatic Votemap
« on: March 25, 2009, 11:37:22 AM »
This is my full automatic votemap system.
You can add maps to a pool which are used for votes.


Its very usefull, if you want a mapcycle where the players can choose the nextmap.
It works like the Metamod addon for TF2 or Css

Ulx is required to run this module.
Extract the lua to your ulx/lua/modules folder and extract the mapcycle.txt to your data folder.
Restart the server.

Have fun
DrTight
« Last Edit: March 26, 2009, 02:19:48 PM by DrTight »

Offline benbrooks

  • Newbie
  • *
  • Posts: 28
  • Karma: 2
Re: Automatic Votemap
« Reply #1 on: March 27, 2009, 02:40:56 PM »
When you say 'ulx/lua/modules', well, There isn't one.

There are however these;

'ulx/lua/ULib/modules'
'ulx/lua/ulx/modules'

I suspect that it's ulx, since that's where most of the other 'plugins' are like fun commands and stuff. Just thought i'd let you know ;)

Offline DrTight

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
Re: Automatic Votemap
« Reply #2 on: March 27, 2009, 03:49:12 PM »
Oh sry, i forgot, its ulx/modules :D

Offline BBgamer

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Automatic Votemap
« Reply #3 on: May 15, 2009, 02:00:30 PM »
Thankyou, perfect for my Gjail server! Now i can have votes to change to ba_jail_mars or ba_jail_v4!

Offline DeimosTK

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Autovotemap Error
« Reply #4 on: March 19, 2010, 08:31:24 PM »
Last week, DrTight's Automapvote script was working fine and dandy in my server on an older version of ULX. I recently decided to update to the SVN version, so the automapvote script similarly decided to not work anymore. It's giving the following error:
Code: [Select]
Warning: vgui.Create failed to create the VGUI component (DFrame)
ulx/modules/cl/cl_automapvote.lua:37: attempt to index local 'main' (a nil value)

This is the piece of code in question:
Code: [Select]
local function PaintClockFrame()
local main = vgui.Create( "DFrame" )
main:SetSize(250,60)
main:SetPos(ScrW() /2 - (main:GetWide() /2),ScrH() - main:GetTall())
main:ShowCloseButton(false)
main:SetDraggable(false)
main:SetTitle("")
main:ShowCloseButton(false)

function main:Paint()
local str = timeToStr(timeleft)
local nxtmp = "Next Map: "..nextmap
local votestr = "Changing in: "..str
if !votedone then
nxtmp = "Current Map: "..nextmap
votestr = "Next Vote: "..str
end
local h,w = main:GetWide(), main:GetTall()
surface.SetDrawColor( 255, 255, 255, 120 )
surface.DrawRect( 1, 1,h-1 ,w-1)
surface.SetDrawColor( 100, 100, 255, 240 )
surface.DrawOutlinedRect( 0,0,h,w )
draw.SimpleText(votestr,"ScoreboardText",10,5,Color(100,0,0,200))
draw.SimpleText("Votes Left: "..votesleft,"ScoreboardText",10,20,Color(0,0,0,200))
draw.SimpleText(nxtmp,"ScoreboardText",10,35,Color(0,0,0,200))
end
return main
end


Now seeing as the script itself was unchanged, it's also entirely possible that I simply put the files in the wrong folders after updating ULX. They're in the following locations:
Code: [Select]
garrysmod/addons/ulx/lua/ulx/modules/sv_automapvote.lua
garrysmod/addons/ulx/lua/ulx/modules/cl/cl_automapvote.lua

Anyone have any ideas?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Automatic Votemap
« Reply #5 on: March 19, 2010, 09:47:06 PM »
1) It's possible the original code isn't compatible with SVN.
Much of SVN of ULib and it's module ULX command structure has been rewritten. Imagine the differences between Windows XP and Windows 7... many things can be converted, but, they have to be converted.

2) Your comment of location.
Extract the lua to your ulx/lua/modules folder and extract the mapcycle.txt to your data folder.
No idea how to set up mapcycle.txt, as I can't see his original code, but it would go in gmod/data
So;
gmod/data/mapcycle.txt
gmod/addons/ulx/lua/ulx/modules/cl_automapvote.lua
gmod/addons/ulx/lua/ulx/modules/sv_automapvote.lua
Would be your best bet

Again though, even some file structure of ULX has changed in SVN.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Automatic Votemap
« Reply #6 on: March 19, 2010, 10:25:05 PM »
What line is line 37?
Experiencing God's grace one day at a time.

Offline DeimosTK

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Automatic Votemap
« Reply #7 on: March 20, 2010, 12:47:34 AM »
gmod/addons/ulx/lua/ulx/modules/cl_automapvote.lua
So cl_ goes into the main modules folder instead of the modules/cl/ one?

What line is line 37?
Code: [Select]
36  local main = vgui.Create( "DFrame" )
37 main:SetSize(250,60)
38 main:SetPos(ScrW() /2 - (main:GetWide() /2),ScrH() - main:GetTall())
39 main:ShowCloseButton(false)
40 main:SetDraggable(false)
41 main:SetTitle("")
42 main:ShowCloseButton(false)
It's the main.SetSize one immediately after main is set up
« Last Edit: March 20, 2010, 03:00:39 AM by DeimosTK »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Automatic Votemap
« Reply #8 on: March 20, 2010, 12:04:59 PM »
Do you still have the derma folder under addons? It looks like derma is completely broken for you.
Experiencing God's grace one day at a time.

Offline DeimosTK

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Automatic Votemap
« Reply #9 on: March 20, 2010, 01:31:39 PM »
Nope, derma is still there, and other plugins utilizing vgui (UTime, UMaps) are working fine :[

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Automatic Votemap
« Reply #10 on: March 20, 2010, 03:04:04 PM »
Don't know about UMaps, but I'm fairly certain that UTime doesn't use derma. Does the file "garrysmod\addons\derma\lua\vgui\dframe.lua" exist?
Experiencing God's grace one day at a time.

Offline DeimosTK

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Automatic Votemap
« Reply #11 on: March 21, 2010, 12:33:39 AM »
Oh my mistake, I guess I was confusing vgui with derma. And yes, that "dframe.lua" file is there.

Offline PowerHouse

  • Newbie
  • *
  • Posts: 12
  • Karma: 1
Re: Automatic Votemap
« Reply #12 on: August 28, 2010, 02:08:37 PM »
Is this discontinued? Because the link renders a "File not Found" error.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Automatic Votemap
« Reply #13 on: August 28, 2010, 04:32:12 PM »
Most likely.

DrTight -
Last Active:
    April 04, 2009, 11:13:16 AM

Next release of ULib (and ULX) is coming soon.
Might be a good project for those learning Glua and Ulib to convert to current Glua and ULib code structures.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming