Author Topic: Automatic Votemap  (Read 1506 times)

0 Members and 1 Guest are viewing this topic.

Offline DrTight

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
    • View Profile
Automatic Votemap
« on: March 25, 2009, 10: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, 01:19:48 PM by DrTight »

Offline benbrooks

  • Newbie
  • *
  • Posts: 28
  • Karma: 2
    • View Profile
Re: Automatic Votemap
« Reply #1 on: March 27, 2009, 01: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
    • View Profile
Re: Automatic Votemap
« Reply #2 on: March 27, 2009, 02:49:12 PM »
Oh sry, i forgot, its ulx/modules :D

Offline BBgamer

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: Automatic Votemap
« Reply #3 on: May 15, 2009, 01: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: 11
  • Karma: 0
    • View Profile
Autovotemap Error
« Reply #4 on: March 19, 2010, 07: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: 3262
  • Karma: 106
  • Project Specialist
    • View Profile
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Automatic Votemap
« Reply #5 on: March 19, 2010, 08: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.
Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it - David Pogue

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • ****
  • Posts: 3488
  • Karma: 188
  • Project Lead
    • View Profile
Re: Automatic Votemap
« Reply #6 on: March 19, 2010, 09:25:05 PM »
What line is line 37?
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” -Brian W. Kernighan
"I love working on my crappy code. it is crappy, but it is mine. I guess I could love other people's code, but it's like loving other people's children -- not quite the same as your own" -- Jeff Atwood
"Their tree came and found my tree!" -- Stickly Man!

Offline DeimosTK

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Automatic Votemap
« Reply #7 on: March 19, 2010, 11:47:34 PM »
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, 02:00:39 AM by DeimosTK »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • ****
  • Posts: 3488
  • Karma: 188
  • Project Lead
    • View Profile
Re: Automatic Votemap
« Reply #8 on: March 20, 2010, 11:04:59 AM »
Do you still have the derma folder under addons? It looks like derma is completely broken for you.
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” -Brian W. Kernighan
"I love working on my crappy code. it is crappy, but it is mine. I guess I could love other people's code, but it's like loving other people's children -- not quite the same as your own" -- Jeff Atwood
"Their tree came and found my tree!" -- Stickly Man!

Offline DeimosTK

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Automatic Votemap
« Reply #9 on: March 20, 2010, 12: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: 3488
  • Karma: 188
  • Project Lead
    • View Profile
Re: Automatic Votemap
« Reply #10 on: March 20, 2010, 02: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?
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” -Brian W. Kernighan
"I love working on my crappy code. it is crappy, but it is mine. I guess I could love other people's code, but it's like loving other people's children -- not quite the same as your own" -- Jeff Atwood
"Their tree came and found my tree!" -- Stickly Man!

Offline DeimosTK

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