• Special Round
    19 replies, posted
I'm having problems with an addon called "Special Rounds". It's now a free addon on coderhire but sadly, it doesn't work the way it was uploaded. I'm attempting to make it work by updating bits of it. Please don't give me this "IT'S BROKEN JUST LEAVE IT ALONE" crap. Here's the error: [lua] 22:02:39 Lua Error: [ERROR] addons/specialrounds/lua/hud.lua:103: attempt to index global 'surface' (a nil value) 1. unknown - addons/specialrounds/lua/hud.lua:103 2. include - [C]:-1 3. unknown - addons/specialrounds/lua/autorun/cl_init.lua:4[/lua] Here's the code: [lua] /*hook.Add( "Think", "SR_Think", function() if input.IsKeyDown( KEY_0 ) then RunConsoleCommand( "sr_vote", 1 ); print( "test" ) elseif input.IsKeyDown( KEY_9 ) then RunConsoleCommand( "sr_vote", 2 ); print( "test2" ) end end )*/ local endtime = 0 usermessage.Hook( "SpecialVote", function( um ) endtime = CurTime() + SR_VOTETIME end ) local mode = -1 usermessage.Hook( "SpecialHUD", function( um ) mode = um:ReadLong() if SR_DEBUG then print( "Mode: " .. tostring( mode ) ) end end ) local function SpecialHUD() // Voting Portion of HUD if ( GetGlobalBool( "SpecialVote_IP" ) and endtime > CurTime() ) or SR_DEBUG then local w, h = 130, 128 local x, y = ( ScrW() - w + 6 ), ( ScrH()/2 - h/2 ) local margin = 15 draw.RoundedBox( 6, x, y, w, h, Color( 0, 0, 0, 175 ) ) draw.SimpleText( "Special Round Vote:", "Trebuchet18", x + 6, y + 3, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin + 4 surface.SetDrawColor( 255, 255, 255, 255 ); surface.DrawLine( x + 6, y + 4, x + w - 10, y + 4 ); draw.SimpleText( "1. FFA", "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin draw.SimpleText( "2. TvD", "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin + 4 surface.SetDrawColor( 255, 255, 255, 255 ); surface.DrawLine( x + 6, y + 4, x + w - 10, y + 4 ); draw.SimpleText( "Select by typing:", "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin - 2 draw.SimpleText( "!srvote #", "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin + 4 surface.SetDrawColor( 255, 255, 255, 255 ); surface.DrawLine( x + 6, y + 4, x + w - 10, y + 4 ); draw.SimpleText( "Time Left:" .. tostring( math.ceil( endtime - CurTime() ) ), "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ); y = y + margin + 4 surface.SetDrawColor( 255, 255, 255, 255 ); surface.DrawLine( x + 6, y + 4, x + w - 10, y + 4 ); draw.SimpleText( "FFA: " .. tostring( GetGlobalInt( "SR_Vote_1" ) ) .. " | TvD: " .. tostring( GetGlobalInt( "SR_Vote_2" ) ), "Trebuchet18", x + 6, y + 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM ) end // Main HUD if SR_HUD and ( mode != -1 or SR_DEBUG ) then draw.SimpleText( "Special Round", "SR_Title", ScrW()/2, 120, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) surface.SetDrawColor( 255, 255, 255, 255 ) local time = math.ceil( ( endtime + SR_VOTE_NOTICETIME ) - CurTime() ) if mode == 0 then // Preparing draw.SimpleText( "In Vote (" .. tostring( math.ceil( endtime - CurTime() ) ) .. ")", "SR_Subtitle", ScrW()/2, 195, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) // --------------------------- // surface.SetTexture( inno ) surface.DrawTexturedRect( ScrW()/2 - 220, 225, 60, 60 ) draw.SimpleText( "vs.", "SR_Subtitle", ScrW()/2 - 120, 255, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( tostring( GetGlobalInt( "SR_Vote_1", 0 ) ), "SR_Sub_subtitle", ScrW()/2 - 120, 305, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) surface.DrawTexturedRect( ScrW()/2 - 75, 225, 60, 60 ) // ------------------------------ // surface.SetTexture( traitor ) surface.DrawTexturedRect( ScrW()/2 + 75, 225, 60, 60 ) draw.SimpleText( "vs.", "SR_Subtitle", ScrW()/2 + 180, 255, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( tostring( GetGlobalInt( "SR_Vote_2", 0 ) ), "SR_Sub_subtitle", ScrW()/2 + 180, 305, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) surface.SetTexture( det ) surface.DrawTexturedRect( ScrW()/2 + 220, 225, 60, 60 ) elseif mode == 1 then // FFA surface.SetTexture( inno ) surface.DrawTexturedRect( ScrW()/2 - 175, 165, 60, 60 ) draw.SimpleText( "vs.", "SR_Subtitle", ScrW()/2, 195, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( "Free For All", "SR_Sub_subtitle", ScrW()/2, 245, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) surface.DrawTexturedRect( ScrW()/2 + 115, 165, 60, 60 ) if SR_VOTE_NOTICETIME > 0 and time >= 0 then draw.SimpleText( "Round Starts in: " .. tostring( math.abs( time ) ) .. " seconds", "SR_Sub_subtitle", ScrW()/2, 305, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end elseif mode == 2 then // TVD surface.SetTexture( traitor ) surface.DrawTexturedRect( ScrW()/2 - 175, 165, 60, 60 ) draw.SimpleText( "vs.", "SR_Subtitle", ScrW()/2, 195, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( "Traitors vs. Detectives", "SR_Sub_subtitle", ScrW()/2, 245, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) surface.SetTexture( det ) surface.DrawTexturedRect( ScrW()/2 + 115, 165, 60, 60 ) if SR_VOTE_NOTICETIME > 0 and time >= 0 then draw.SimpleText( "Round Starts in: " .. tostring( time ) .. " seconds", "SR_Sub_subtitle", ScrW()/2, 305, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end end end end hook.Add( "HUDPaint", "SpecialVote_HUD", SpecialHUD ) surface.CreateFont( "SR_Title", { font = "Trebuchet 18", size = 100, weight = 900, antialias = true, shadow = true }) surface.CreateFont( "SR_Subtitle", { font = "Trebuchet 18", size = 60, weight = 600, antialias = true, shadow = true }) surface.CreateFont( "SR_Sub_subtitle", { font = "Trebuchet 18", size = 45, weight = 400, antialias = true, shadow = true }) [/lua] Bit of clarification, 103 is: surface.CreateFont( "SR_Title",
snip
[QUOTE=Jeezy;44097856]It doesn't look free to me.. [url]http://coderhire.com/browse/script/794/ttt-special-rounds[/url][/QUOTE] Apparently the page was deleted. It used to be at [url]http://coderhire.com/forums/thread/277/ttt-special-rounds/1#post-9[/url]
There was a free one at one point, dunno where it is now. @OP, you'd be better off just buying one. hopefully the paid script will be better quality than what you have (and the majority of other coderhire scripts :v:)
[QUOTE=rejax;44097908]There was a free one at one point, dunno where it is now. @OP, you'd be better off just buying one. hopefully the paid script will be better quality than what you have (and the majority of other coderhire scripts :v:)[/QUOTE] The problem is, I've been working on this for a long time now and I don't have the money to buy it.
-snip- Refreshed late, didn't see your other post.
[QUOTE=code_gs;44097920]Ask the creator of the addon. Also, don't post entire code sections if it's from coderhire.[/QUOTE] I see it to be fair considering I didn't get it from the paid version. It is also one small part of the whole addon so posting one section shouldn't be too big of a deal. "Shouldn't" being the key word, though.
It seems surface is trying to be called from the server. I believe the script should only be executed by the client.
[QUOTE=Jeezy;44097947]It seems surface is trying to be called from the server. I believe the script should only be executed by the client.[/QUOTE] I know some LUA but not a lot. What are my options to fix it?
Burmp
I'm guessing it's around the CreateFont portion? right before the HUD hook / before the CreateFont just add: [lua]if ( SERVER ) then return; end[/lua]
People doesn't have money for scripts, so they pirate these, but they have money for pay dedicated servers :v And as acecool said, you're drawing the hud on the server
[QUOTE=gonzalolog;44209149]People doesn't have money for scripts, so they pirate these, but they have money for pay dedicated servers :v And as acecool said, you're drawing the hud on the server[/QUOTE] I pay 60 dollars for three years of my server with as many slots as I want - many others do too. why waste money on 3-10 scripts which could host your server for three years, especially when you have little to no income?
[QUOTE=MeepDarknessM;44209189]I pay 60 dollars for three years of my server with as many slots as I want - many others do too. why waste money on 3-10 scripts which could host your server for three years, especially when you have little to no income?[/QUOTE] Why should people be forced to give away their hard-work for free? If you want it free then learn Lua and make it yourself. Personally, I have a lot of medical issues stemming from a car accident in May 2011 with everything in my life going down-hill fast; I'm not expected to last much longer. I have no income; I can barely move and wake-up some days completely unable to move my arms and legs combined with the sensation of them on fire. If I make something and want to charge so that I can pay for my prescriptions, medical bills and for food, why should I be forced to give out what little work I can do when, I'm not stuck in bed, for free? Why should others be forced to give it out for free? Why waste money on something? I don't call it a waste of money when it's a quality piece. Why not pay creators for their hard work; especially if it's a quality work? You wouldn't pay a 6 year old to paint your house, would you? I mean, they'd probably forget to put down protective plastic/paper on the floors and covers over the furniture so you'd come back with paint dots all over your hardwood or carpet flooring, on the furniture, etc. You'd either do it yourself and follow proper procedure or hire an insured company to do the work so that if something is damaged or not done properly you can receive support or they'd have to replace the damaged property. Additionally you wouldn't pay a child to replace the brakes on your car; you'd either do it yourself while following proper procedure or pay someone $500 for a brake-job ( They cost so much because stopping is pretty important and the company needs insurance in case they screw up ). The point being, if you can pay someone an amount of money for code to run on your server which will end up getting more players on your server with a chance of receiving donations because they like your server; then be prepared to either code it yourself or pay someone for it.
[QUOTE=Acecool;44209397]Why should people be forced to give away their hard-work for free? If you want it free then learn Lua and make it yourself. Personally, I have a lot of medical issues stemming from a car accident in May 2011 with everything in my life going down-hill fast; I'm not expected to last much longer. I have no income; I can barely move and wake-up some days completely unable to move my arms and legs combined with the sensation of them on fire. If I make something and want to charge so that I can pay for my prescriptions, medical bills and for food, why should I be forced to give out what little work I can do when, I'm not stuck in bed, for free? Why should others be forced to give it out for free? Why waste money on something? I don't call it a waste of money when it's a quality piece. Why not pay creators for their hard work; especially if it's a quality work? You wouldn't pay a 6 year old to paint your house, would you? I mean, they'd probably forget to put down protective plastic/paper on the floors and covers over the furniture so you'd come back with paint dots all over your hardwood or carpet flooring, on the furniture, etc. You'd either do it yourself and follow proper procedure or hire an insured company to do the work so that if something is damaged or not done properly you can receive support or they'd have to replace the damaged property. Additionally you wouldn't pay a child to replace the brakes on your car; you'd either do it yourself while following proper procedure or pay someone $500 for a brake-job ( They cost so much because stopping is pretty important and the company needs insurance in case they screw up ). The point being, if you can pay someone an amount of money for code to run on your server which will end up getting more players on your server with a chance of receiving donations because they like your server; then be prepared to either code it yourself or pay someone for it.[/QUOTE] I in no way support people pirating lua scripts nor forcing a specific license for all lua code. think of it this way: we both have no money and cant afford anything really, so how would we spare money if we can barely afford the served that hosts what we buy? I don't want to I don't want to argue about this in depth here, but if you want post on my profile.
As others have said this may be the free version; if it was released to the public for free use then it can't really be retracted from free use to those that were able to download it ( Big IF; IF the original creator was the one to post it; IF someone who purchased it posted it there when asking for help then it's a leak ). Are you able to prove that this isn't a leaked paid-version? If so, add me on Steam and I'll help you out: steamcommunity.com/id/Acecool Edit: Lost internet; just got it back.
[QUOTE=Acecool;44210898]As others have said this may be the free version; if it was released to the public for free use then it can't really be retracted from free use to those that were able to download it ( Big IF; IF the original creator was the one to post it; IF someone who purchased it posted it there when asking for help then it's a leak ).[/QUOTE] The original creator took down his link and when a customer tried to contact him, they got no reply. They then put it up for free, but it was broken. Think of it this way. A boy gives his toy away because it's broken. Another kid gets it from him but he takes it to the repair shop to get it fixed because they have a free service.
[QUOTE=Wubsy;44211579]The original creator took down his link and when a customer tried to contact him, they got no reply. They then put it up for free, but it was broken.[/QUOTE] I don't quite follow; a disgruntled customer ( they? ) put it up? That would explain why it's removed. Or did the creator put it up?
[QUOTE=Acecool;44211593]I don't quite follow; a disgruntled customer ( they? ) put it up? That would explain why it's removed. Or did the creator put it up?[/QUOTE] Read post above plz thx.
I can confirm this was a publically posted script on CH forums.
Sorry, you need to Log In to post a reply to this thread.