Time Failed! and bad argument 'FindByClass' issues

Errors in server console:

Time Failed! entire function:

Line 127 is the “timer.Simple” line.

For the bad argument here is the lua for the default_map.lua:

Any help would be greatly appreciated :slight_smile:

What calls RemoveEntByClass? Either the class isn’t being sent in, or it’s just nil being sent in.

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

It’s for a gamemode created by someone else, fixed to work with the gmod13 and now being tweaked by me :stuck_out_tongue:

It totally depens what class is.

[editline]17th August 2014[/editline]

That doesn’t answer my question.

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.

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]

I feel really stupid but I’m just not seeing what I’d have to do :confused:
Would I place function before the MAP.RemoveEntByClass?

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.


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 )

If this works it would also remove the need for your entire MAP:RemoveEntsByClass function