Page 1 of 1

Draw Crosshair

Posted: Tue May 29, 2018 9:49 am
by canibozz
Is it possible to draw the users crosshair?

Like, if i pick a scout, it disappears.

Is it possible to "force" the client to have a crosshair?

Cheers!

Re: Draw Crosshair

Posted: Tue May 29, 2018 2:28 pm
by Speed0x
i think the "crosshair-look" is clientside and forced by the weapon. you can only enable and disable it on the server , using HideHudFlag, but not switching it from one weapon to the other etc... and i guess that's what you were looking for...

( btw. messing with the inventory ( e.g. weapon ) settings got me banned by valve from using gameservers, so be careful - in case you were thinking of faking the weaponhandle to the client or w/e :P )

Re: Draw Crosshair

Posted: Tue May 29, 2018 2:29 pm
by decompile
Hey,

I think theres currently no cvar which draws the crosshair for scouts or when you are disarmed.

But there are probably some try-around ways:

1. Create an Screenoverlay with a custom crosshair and send it to the player if he equiped that weapon
2. (FOR DISARMED ONLY) Give the player a weapon which shows crosshair and make it invinsible + block any interactions with it like shooting.
3. Send a Center TextMSG with a symbol like a cross or circle and position it into the middle of the screen.

Re: Draw Crosshair

Posted: Tue May 29, 2018 2:31 pm
by Speed0x
yes you can use screenoverlay + .vmt but i think that is not auto-adjusting to screensize, so really ugly. would not recommend..

also, in case you are just doing this for fun, you can always just edit the existing clientside .vmt file for the scoutoverlay and change it to your likings :P, but that is changing clientside files and corrupts cache integrity with the game, so i would only do that for testings locally and change it back if you want to play online

Re: Draw Crosshair

Posted: Tue May 29, 2018 2:59 pm
by canibozz
It's for a ServerSide mod.
Sadly the weapon_debug_spread_show 3 can't be forced by cmd usage because the client blocks it.

Re: Draw Crosshair

Posted: Tue May 29, 2018 3:24 pm
by VinciT
Here's a simple and dirty way to get a crosshair on snipers (decompile's 3rd suggestion):



Speed0x wrote:yes you can use screenoverlay + .vmt but i think that is not auto-adjusting to screensize, so really ugly. would not recommend..
I can think of two ways around this. Using a custom particle with the screenoverlay option enabled or by creating an env_sprite and parenting it to the predicted_viewmodel. But I feel like the HudMsg way of doing it should be good enough.