ConCommand a nil value?

Timer Error: weapons/kick_n_rag/shared.lua:69: attempt to call method ‘ConCommand’ (a nil value)
I keep getting concommand as a nil value when it worked perfectly before, I had no problems then one day, I started up my gamemode and it gave me this fucking error…
[lua]
timer.Simple( 0.32, function()
local trace = self.Owner:GetEyeTrace();
trace.Entity:ConCommand(“rm_ragdolize” )–problem here–
end)
[/lua]
I tried everything… the only thing I can do now is waiting for some help…

You need to check whether the trace hit and the hit entity is a player before you can call a method on it that is specific to players.

[editline]05:23PM[/editline]

[lua]if trace.Hit and trace.Entity:IsPlayer() then[/lua]

Seems like it wont work though, I tried exactly what you posted me first then I tried to adapt it to my situation.
This time it doesn’t show the error but it just doesn’t work, everything else works fine.

Try using something like this instead.

[lua]local trace = {}
trace.start = self.Owner:EyePos()
trace.endpos = self.Owner:GetEyeTrace()
trace.mask = 1174421507
local tr = util.TraceLine(trace)[/lua]

Your idea is messy anyway. You’re having the server send a command to the client asking it to send a console command to the server so that the server can ragdolize him.

Skip the extra steps and ragdolize directly.

I already tried that, I think I’ll mix some stuff up and make some kind of direct function plus [FlapJack]'s system; anyway, thanks

[editline]omg ur replying :OOO[/editline]

Nothing. It didn’t work, so I decided to deal with it and create a function hooked to think that ragdolize the player if he has a bool named “ragalreadyffs” true. It finally works though, this is the most rude way.