• Chat Advert HELP!
    20 replies, posted
  • Hi, Im working on a built from-the-ground-up admin mod, and the first feture I want it to have intigrated is Chat Adverts, I thought of looping Chat.AddText, but I dont want to be raped by anti loop protection. So... All I have is this so far: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_adverts.lua -- By Lukeme99 ------------------------------------ -- chat.AddText( Color(255,150,0), "This server is running, Evo X Admin Mod Version: ", EV_Version, chat.PlaySound() [/CODE] I have an autorun which includes this, but thats all so far. Any help would be really apreciated! (And maybe mentioned in credits.lua)
  • [code] local Tab = {"This server is running, Evo X Admin Mod Version: ".. EV_Version, "Blah blah blah"} timer.Create("Advertising",50,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end) [/code] Is this what you are looking for?
  • [QUOTE=UnkownAlias;36687506][code] local Tab = {"This server is running, Evo X Admin Mod Version: ".. EV_Version, "Blah blah blah"} timer.Create("Advertising",50,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end) [/code] Is this what you are looking for?[/QUOTE] YES! Thank you! Your getting added to credits.lua now! Also do you just add another line of local Tab = for another advert? And will it also have 50 seconds between?
  • Yes, to add a new advert just follow the example of "blah blah blah"... Add a comma and there you go.
  • [QUOTE=UnkownAlias;36687506][code] local Tab = {"This server is running, Evo X Admin Mod Version: ".. EV_Version, "Blah blah blah"} timer.Create("Advertising",50,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end) [/code] Is this what you are looking for?[/QUOTE] Errrr, One small problem, it gave me an error: [CODE]Timer 'Advertising' Error: [addons\evo x\lua\ev_core\ev_adverts.lua:13] attempt to index global 'chat' (a nil value) unknown lua\includes\modules\timer.lua:161 pcall [C]:-1 unknown lua\includes\modules\hook.lua:74[/CODE] This is for Garrys Mod 13, By The Way... [editline]9th July 2012[/editline] Ok, for some reason this doesnt work in Garrys Mod 13! Any idea why? [CODE]local Tab = {} Tab[1] = "This server is running, Evo X Admin Mod Version: ".. EV_Version, " By Lukeme99" Tab[2] = "Suport The developer by donating at (Insert Website Here)" timer.Create("Advertising",5,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end)[/CODE] Thanks.
  • Are you running it clientside? this will not work on shared/server, It must only be run by clients. What color are the errors?
  • [QUOTE=UnkownAlias;36688177]Are you running it clientside? this will not work on shared/server, It must only be run by clients. What color are the errors?[/QUOTE] The colours are blue (same colour as Lua initialized 5.1). How would you run it client side?
  • Avatar of Mister C
  • [QUOTE=_Lukeme99_;36688285]The colours are blue (same colour as Lua initialized 5.1). How would you run it client side?[/QUOTE] You can put it in an if statment like this, [lua] if CLIENT then end[/lua] or if the whole file is for the client, just put this at the top: [lua]if SERVER then return end;[/lua]
  • [QUOTE=Mister C;36688412]You can put it in an if statment like this, [lua] if CLIENT then end[/lua] or if the whole file is for the client, just put this at the top: [lua]if SERVER then return end;[/lua][/QUOTE] Ok, I tried it, got no errors, but neither did I get any ads either :/ This is the code: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_adverts.lua -- By Lukeme99 ------------------------------------ if SERVER then return end; -- Make File Client ONLY local Tab = {} Tab[1] = "This server is running, Evo X Admin Mod Version: ".. EV_Version, " By Lukeme99" Tab[2] = "Suport The developer by donating at (Insert Website Here)" timer.Create("Advertising",5,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end)[/CODE] WHAT STILL AM I DOING WRONG?
  • Avatar of Mister C
  • [QUOTE=_Lukeme99_;36689189]Ok, I tried it, got no errors, but neither did I get any ads either :/ This is the code: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_adverts.lua -- By Lukeme99 ------------------------------------ if SERVER then return end; -- Make File Client ONLY local Tab = {} Tab[1] = "This server is running, Evo X Admin Mod Version: ".. EV_Version, " By Lukeme99" Tab[2] = "Suport The developer by donating at (Insert Website Here)" timer.Create("Advertising",5,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end)[/CODE] WHAT STILL AM I DOING WRONG?[/QUOTE] I copied and pasted what you had into my game and everything ran fine. Here is [URL="http://cloud-2.steampowered.com/ugc/936997007132725592/322D26D21F50D7746CC1BC9AF6448733882D41FE/"]proof[/URL]! Perhaps you didn't include this file to the client?
  • [QUOTE=Mister C;36689335]I copied and pasted what you had into my game and everything ran fine. Here is [URL="http://cloud-2.steampowered.com/ugc/936997007132725592/322D26D21F50D7746CC1BC9AF6448733882D41FE/"]proof[/URL]! Perhaps you didn't include this file to the client?[/QUOTE] It works fine in gmod 10/11/12 but I want it to work in 13, thats what this is designed for! So could someone please find out why this fails in GM13?
  • Avatar of Mister C
  • [QUOTE=_Lukeme99_;36689431]It works fine in gmod 10/11/12 but I want it to work in 13, thats what this is designed for! So could someone please find out why this fails in GM13?[/QUOTE] Heh... Forgot I read that... GIVE ME A MINUTE. I will solve it. :3 Edit: I didn't see anything changed in ether the timer or chat libraries. I guess you are going to have to double check to make sure everything is included properly. Also, Here is the [URL="https://docs.google.com/document/d/1dVgp8ojkrIjxVRFADUF5uwZQiLLivHixkmV5PW5v9Fw/edit"]Gmod13 changelog[/URL]. Edit2: It works perfectly for me in Gmod13. [URL="http://cloud-2.steampowered.com/ugc/936997007132969528/6D1552DFD843819FE1616C020148D57945215D44/"]Proof[/URL]. Like I said, if this is an addon make sure you are pushing and including this to the client.
  • Ok, because im getting really pissed, here is the entire admin mod! (Please dont critisise me for my crappy little mod) Feel free to run it yourselves! Evo X/lua/autorun/server/autorun.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: Autorun.lua -- By Lukeme99 ------------------------------------ EV_Version = 1.0 --For other scripts? EV = {} EV.CGod = {} EV.Frozen = {} EV.Commands = {} EV.AdvertCounter = 1 Msg("--------------------------------------------\n") Msg("Evo X Admin Mod By Lukeme99: Loading...\n") Msg("--------------------------------------------\n\n") Msg("Loading Chat Adverts...\n") include( "ev_core/ev_adverts.lua" ) Msg( "Load Succesful!\n\n" ) Msg("Loading Credits...\n") include( "ev_core/credits/credits.lua" ) Msg( "Load Succesful!\n\n" ) Msg("-----------------------------------------------------\n") Msg("Evo X Admin Mod By Lukeme99: Loaded Successfully\n") Msg("-----------------------------------------------------\n\n") [/CODE] Evo X/lua/ev_core/ev_adverts.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_adverts.lua -- By Lukeme99 ------------------------------------ if SERVER then return end; -- Make File Client ONLY local Tab = {} Tab[1] = "This server is running, Evo X Admin Mod Version: ".. EV_Version, " By Lukeme99" Tab[2] = "Suport The developer by donating at (Insert Website Here)" timer.Create("Advertising",5,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end) [/CODE] Evo X/lua/ev_core/credits/credits.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: credits.lua -- By Lukeme99 ------------------------------------ function CreditsConVar(client, command, arguments) print("\n\n-----------------------------------------------------") print("-----------------------------------------------------") print( "Thanks to: " ) print( "" ) print( "" ) print( "" ) print( "Thanks to these FacePunchers:") print( "" ) print( "UnkownAlias - For help with chat ads." ) print( "Mister C - For fixing the chat ads." ) print("-----------------------------------------------------") print("-----------------------------------------------------\n\n") end concommand.Add("ev_credits", CreditsConVar) [/CODE] Thank youif you get this to wor in [B]Garrysmod [U]13[/U][/B]! [editline]9th July 2012[/editline] [QUOTE=Mister C;36689481]Like I said, if this is an addon make sure you are pushing and including this to the client.[/QUOTE] How do you do this so called pushing and including?
  • Avatar of SeveredSkull
  • Dude... No offense, and I admire your determination... But if you have no idea what he is talking about, you certainly shouldn't be starting scripting by making an admin mod... Start simple and work your way up. By "Pushing" he means making them download to the client by using AddCSLua()
  • Avatar of Mister C
  • [QUOTE=SeveredSkull;36690209]Dude... No offense, and I admire your determination... But if you have no idea what he is talking about, you certainly shouldn't be starting scripting by making an admin mod... Start simple and work your way up. By "Pushing" he means making them download to the client by using AddCSLua()[/QUOTE] It's alright. I just explained everything to him via Skype.
  • [QUOTE=SeveredSkull;36690209]Dude... No offense, and I admire your determination... But if you have no idea what he is talking about, you certainly shouldn't be starting scripting by making an admin mod... Start simple and work your way up. By "Pushing" he means making them download to the client by using AddCSLua()[/QUOTE] I used to be really active, a long time ago, gamemodes, sweps, stools etc, then my gmod broke, is still broken, but now I live for GM13! The only reason I didint understand this "pushing" is because I only developed for more organised modules, eg a SWEP has to be done EXACTLY like x y z and gamemodes are really tidy, this is the first ever lua project which doesnt have a specific skeleton!
  • [QUOTE=SeveredSkull;36690209] By "Pushing" he means making them download to the client by using AddCSLua() [/QUOTE] Sorry to counter an asshole-ish response but it's actually AddCSLuaFile(). If you want to criticize someone for not understanding something, please understand it yourself first.
  • Avatar of SeveredSkull
  • [QUOTE=Caerian;36714038]Sorry to counter an asshole-ish response but it's actually AddCSLuaFile(). If you want to criticize someone for not understanding something, please understand it yourself first.[/QUOTE] Sorry to counter a douche-ish response... But I know and understand it. Thank you very much.
  • Avatar of Chessnut
  • If it is still broken, you improperly concatenated yor string for the first ad. [lua] Tab[1] = "This server is running, Evo X Admin Mod Version: "..EV_Version.." By Lukeme99 and the request section of Facepunch."[/lua] That should work.
  • [QUOTE=Chessnut;36716398]If it is still broken, you improperly concatenated yor string for the first ad. [lua] Tab[1] = "This server is running, Evo X Admin Mod Version: "..EV_Version.." By Lukeme99 and the request section of Facepunch."[/lua] That should work.[/QUOTE] I actually changed it to look that a while ago, its down to AddCS and include not functioning corectly, but thanks for confirming that, I was never sure of that being corect.
  • Avatar of goldenlukis
  • This should work. lua/autorun/evx_autorun.lua: [CODE] ------------------------------------ -- Evo X Admin Mod -- File: evx_autorun.lua -- By Lukeme99 ------------------------------------ if SERVER then AddCSLuaFile( "ev_core/ev_client.lua") include( "ev_core/ev_server.lua" ) else include( "ev_core/ev_client.lua" ) end[/CODE] lua/ev_core/ev_server.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_server.lua -- By Lukeme99 ------------------------------------ EV_Version = 1.0 --For other scripts? EV = {} EV.CGod = {} EV.Frozen = {} EV.Commands = {} EV.AdvertCounter = 1 Msg("--------------------------------------------\n") Msg("Evo X Admin Mod By Lukeme99: Loading...\n") Msg("--------------------------------------------\n\n") Msg("Loading Chat Adverts...\n") AddCSLuaFile( "ev_adverts.lua" ) Msg( "Load Succesful!\n\n" ) Msg("Loading Credits...\n") AddCSLuaFile( "credits.lua" ) include( "credits.lua" ) Msg( "Load Succesful!\n\n" ) Msg("-----------------------------------------------------\n") Msg("Evo X Admin Mod By Lukeme99: Loaded Successfully\n") Msg("-----------------------------------------------------\n\n") [/CODE] lua/ev_core/ev_client.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_client.lua -- By Lukeme99 ------------------------------------ include("ev_adverts.lua") include("ev_credits.lua")[/CODE] lua/ev_core/ev_adverts.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_adverts.lua -- By Lukeme99 ------------------------------------ local Tab = { "This server is running, Evo X Admin Mod Version: ".. EV_Version.." By Lukeme99", "Suport The developer by donating at (Insert Website Here)", "Blah Blah Blah" } timer.Create("Advertising",5,0,function() chat.AddText(Color(255,150,0), table.Random(Tab)) chat.PlaySound() end)[/CODE] lua/ev_core/ev_credits.lua: [CODE]------------------------------------ -- Evo X Admin Mod -- File: ev_credits.lua -- By Lukeme99 ------------------------------------ function CreditsConVar(client, command, arguments) print("\n\n-----------------------------------------------------") print("-----------------------------------------------------") print( "Thanks to: " ) print( "" ) print( "" ) print( "" ) print( "Thanks to these FacePunchers:") print( "" ) print( "UnkownAlias - For help with chat ads." ) print( "Mister C - For fixing the chat ads." ) print( "Rynoxx - For help with the AddCSLuaFile & Include.") -- Goldenlukis print("-----------------------------------------------------") print("-----------------------------------------------------\n\n") end concommand.Add("ev_credits", CreditsConVar)[/CODE]