Draw Crosshair

Please post any questions about developing your plugin here. Please use the search function before posting!
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Draw Crosshair

Postby canibozz » Tue May 29, 2018 9:49 am

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!
User avatar
Speed0x
Member
Posts: 44
Joined: Sun Feb 05, 2017 4:55 pm
Location: Germany, Hanover
Contact:

Re: Draw Crosshair

Postby Speed0x » Tue May 29, 2018 2:28 pm

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 )
Last edited by Speed0x on Tue May 29, 2018 2:31 pm, edited 2 times in total.
decompile
Senior Member
Posts: 349
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Draw Crosshair

Postby decompile » Tue May 29, 2018 2:29 pm

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.
User avatar
Speed0x
Member
Posts: 44
Joined: Sun Feb 05, 2017 4:55 pm
Location: Germany, Hanover
Contact:

Re: Draw Crosshair

Postby Speed0x » Tue May 29, 2018 2:31 pm

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
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Re: Draw Crosshair

Postby canibozz » Tue May 29, 2018 2:59 pm

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.
User avatar
VinciT
Member
Posts: 63
Joined: Thu Dec 18, 2014 2:41 am

Re: Draw Crosshair

Postby VinciT » Tue May 29, 2018 3:24 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest