• Time Failed! and bad argument 'FindByClass' issues
    11 replies, posted
[B]Errors in server console:[/B] [url]http://i.imgur.com/ZtSATrQ.png[/url] Time Failed! entire function: [url]http://paste.ubuntu.com/8076058/[/url] Line 127 is the "timer.Simple" line. For the bad argument here is the lua for the default_map.lua: [url]http://paste.ubuntu.com/8076122/[/url] Any help would be greatly appreciated :)
What calls RemoveEntByClass? Either the class isn't being sent in, or it's just nil being sent in.
[QUOTE=Judd;45722301][B]Errors in server console:[/B] [url]http://i.imgur.com/ZtSATrQ.png[/url] Time Failed! entire function: [url]http://paste.ubuntu.com/8076058/[/url] Line 127 is the "timer.Simple" line. For the bad argument here is the lua for the default_map.lua: [url]http://paste.ubuntu.com/8076122/[/url] Any help would be greatly appreciated :)[/QUOTE] Correct me if I'm wrong but for the FindByClass function aren't you supposed to specify a string? That seems the reason for why it's throwing off an error that's expecting a string [url]http://wiki.garrysmod.com/page/ents/FindByClass[/url]
[QUOTE=code_gs;45722426]What calls RemoveEntByClass? Either the class isn't being sent in, or it's just nil being sent in.[/QUOTE] It's for a gamemode created by someone else, fixed to work with the gmod13 and now being tweaked by me :p
[QUOTE=Chimpanzee;45722451]Correct me if I'm wrong but for the FindByClass function aren't you supposed to specify a string? That seems the reason for why it's throwing off an error that's expecting a string [url]http://wiki.garrysmod.com/page/ents/FindByClass[/url][/QUOTE] It totally depens what class is. [editline]17th August 2014[/editline] [QUOTE=Judd;45722459]It's for a gamemode created by someone else, fixed to work with the gmod13 and now being tweaked by me :p[/QUOTE] That doesn't answer my question.
[QUOTE=code_gs;45722462]It totally depens what class is. [editline]17th August 2014[/editline] That doesn't answer my question.[/QUOTE] Should have also added that I'm still very noobish with this and have no idea, I'm actually trying to learn more from getting this gamemode to work the way I want it to.
[QUOTE=code_gs;45722462]It totally depens what class is. [/QUOTE] Yeah, but in this case the error is literally saying it was expecting a string, is it not? I'm sorry if I'm not comprehending this properly, I'm very tired
I believe the issue is that timer.Simple is being called incorrectly, the old way I think. Check out the arguments for it now, and see if you can figure it out, I could just tell you exactly what to change but I don't think that'd help you learn. [lua] timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "weapon_*" ); timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "item_*" ); timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "ammo_*"); [/lua] [url]http://wiki.garrysmod.com/page/timer/Simple[/url]
[QUOTE=Jeezy;45722586]I believe the issue is that timer.Simple is being called incorrectly, the old way I think. Check out the arguments for it now, and see if you can figure it out, I could just tell you exactly what to change but I don't think that'd help you learn. [lua] timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "weapon_*" ); timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "item_*" ); timer.Simple( 1.5, MAP.RemoveEntByClass, MAP, "ammo_*"); [/lua] [url]http://wiki.garrysmod.com/page/timer/Simple[/url][/QUOTE] I feel really stupid but I'm just not seeing what I'd have to do :/ Would I place function before the MAP.RemoveEntByClass?
[QUOTE=Judd;45722668]I feel really stupid but I'm just not seeing what I'd have to do :/ Would I place function before the MAP.RemoveEntByClass?[/QUOTE] He's saying the arguments you're using aren't exactly what timer.Simple wants. It wants the delay, and then the function, and it seems as if you're doing something odd? I'm way too tired to actually pay attention to the code and realize what you're doing with [lua]MAP, "weapon_*"[/lua] in the code. If in the function MAP.RemoveEntByClass the ( class ) argument is where you're defining the class, why not just do MAP.RemoveEntByClass("weapon_*") or whatever the proper form of it is in the function section of the timer
This is what it should look like as far as I know. [CODE]timer.Simple( 1.5, function() ents.FindByClass( "weapon_*" ):Remove() end ) timer.Simple( 1.5, function() ents.FindByClass( "item_*" ):Remove() end ) timer.Simple( 1.5, function() ents.FindByClass( "ammo_*" ):Remove() end )[/CODE]
[QUOTE=Chiz Dippler;45724009]This is what it should look like as far as I know. [CODE]timer.Simple( 1.5, function() ents.FindByClass( "weapon_*" ):Remove() end ) timer.Simple( 1.5, function() ents.FindByClass( "item_*" ):Remove() end ) timer.Simple( 1.5, function() ents.FindByClass( "ammo_*" ):Remove() end )[/CODE][/QUOTE] If this works it would also remove the need for your entire MAP:RemoveEntsByClass function
Sorry, you need to Log In to post a reply to this thread.