Run Clientside console command

Hey guys,

I’ve been struggling arround with this for a few hours and now I do not see any chance I can solve this by myself.

Following situation:
I have a server-side script that’s executed when a player gets hurt (using **[Gamemode.PlayerHurt](**). So far, so good, everything works fine just as desired exept one thing:
Under some circumstances, I want to enable the color mod on the client side. My first attempt was to use RunConsoleCommand(“pp_colormod”, “1”) and this worked for me, but of corse for no one else. And yeah, if another player, which got hurt met the requirements to enable colormod, the console command was executed on my computer (if I ran the server). So I really am at a dead end right now.

Can you please lead me to the right path and provide me with a hint or suggestion how to solve this issue best?

Thank you in advance.




Hi |FlapJack|,

thank you for your fast reply.

I also tried player:ConCommand and now I tried it again, but it won’t work … :confused:
Can you please take a look over my code?
I cut everything out that is not needed for that in order to reduce the amount of code … so to say it is just the line of changing the setting of color mod … I also tried just this piece of code, but it also does not work for me.

function myPlayerHurt(player, attacker, healthRemaining, damageDealt)
player:ConCommand(“pp_colormod_color”, “0.5”)
hook.Add(“PlayerHurt”, “myPlayerHurt”, myPlayerHurt)

This time to test it again I just tried to set the value of the color multiplier to 0.5 - but nothing happens …

Thank you in advance



[lua]player:ConCommand(“pp_colormod_color 0.5”)[/lua]

Player.ConCommand works differently to RunConsoleCommand. It takes one argument, which should be a string consisting of the entire command including all parameters.

By passing the argument as player, you override the player library. Call it pl instead.

[lua]function myPlayerHurt(pl, attacker, healthRemaining, damageDealt)
pl:ConCommand(“pp_colormod_color 0.5”)
hook.Add(“PlayerHurt”, “myPlayerHurt”, myPlayerHurt)

You would only be overriding the player library in that one function, doesn’t really matter as long as you won’t be using it in that function.

That’s still not a good habit to have. Get used to calling players “pl” or “ply”, and everything will be less confusing.

Indeed it is, I was just pointing out that calling it player isn’t the problem with is code.

Hi guys,

ok thank you all very much for your help. NullPoint’s suggestion did the trick. I knew it was something that easy … I really feel like an idiot xD
Also thanks to |FlapJack| and _Kilburn for showing me my bad style of naming the arguments… I will change this right away and keep that in mind in the future :slight_smile:



You really shouldn’t be using those commands to enable color stuff on the player, make a clientside script that does this hooked to “RenderScreenspaceEffects” and check the players health or something in the hook. If you do this you won’t have to rely on the player having pp_colormod set to 1.


I’ve tried that, for some reason, the numbers you pass to the concommand do not correspond to
the DrawColorModify function.

Hi CapsAdmin,

thank you for the hint. At the moment the script is just considered for me and my friends playing G-Mod, and I know they will leave color mod enabled, if we want to use that script (although I toggle color mod on at the beginning of the script anyway).
But if I develop the script any further, I will come back to that, good to know it’s possible :).