Raised This Month: $51 Target: $400
 12% 

[L4D2]Is there any way to hide crosshair by server?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LinLinLin
Senior Member
Join Date: Sep 2021
Old 08-20-2022 , 12:32   [L4D2]Is there any way to hide crosshair by server?
Reply With Quote #1

In L4D2 valve mixed the weapon selection and crosshair.If you use m_iHidehud,only ALL(1<<2) and weaponselection(1<<0) will make crosshair disappear. And you will also hide all or the weapon selection hud on your screen.
Well , is there any way server can hide crosshair but no other hud ?
I just want to make the sniper_awp look like in cs:s ,yeah
(may be there will other way to do this like modify the weapon script about crosshair)

PS :
I have found in hl2sdk-l4d2 and i know this m_iHiddenBits "HIDEHUD_WEAPONSELECTION" control the weaponselection(in hud_weapon.cpp).And we can use setentprop(client,Prop_send,"m_iHideHUD") to modify it.
But unfortunately,i don't know why crosshair also paint in this .cpp and there only one bitmask with it,and the hud_crosshair.cpp which i think the most properly to control the crosshair only control the melee_crosshair.......

https://developer.valvesoftware.com/wiki/HudLayout.res
This page show the hud elements in hl2,and hud_weapon really handles the crosshair。

If there something wrong,plesae tell me,very thank.

Last edited by LinLinLin; 08-20-2022 at 15:07.
LinLinLin is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 08-20-2022 , 14:20   Re: [L4D2]Is there any way to hide crosshair?
Reply With Quote #2

I didn't understand much of it, but can u try this in your console

Code:
crosshair 0
__________________
alasfourom is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 08-20-2022 , 15:01   Re: [L4D2]Is there any way to hide crosshair?
Reply With Quote #3

yeah ,this can toggle crosshair in clientside,but i want to control it on server.
This command is client command,server can't hook it or modify it,and that is why i ask for help
LinLinLin is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-20-2022 , 15:12   Re: [L4D2]Is there any way to hide crosshair by server?
Reply With Quote #4

Afaik it's no longer possible to disable crosshair from server side.
__________________
Silvers is offline
Forgetest
Member
Join Date: Aug 2020
Old 08-20-2022 , 15:19   Re: [L4D2]Is there any way to hide crosshair by server?
Reply With Quote #5

PHP Code:
// Hud Element hiding flags
#define HIDEHUD_WEAPONSELECTION     (1 << 0)    // Hide ammo count & weapon selection
#define HIDEHUD_FLASHLIGHT          (1 << 1)
#define HIDEHUD_ALL                 (1 << 2)
#define HIDEHUD_HEALTH              (1 << 3)    // Hide health & armor / suit battery
#define HIDEHUD_PLAYERDEAD          (1 << 4)    // Hide when local player's dead
#define HIDEHUD_NEEDSUIT            (1 << 5)    // Hide when the local player doesn't have the HEV suit
#define HIDEHUD_MISCSTATUS          (1 << 6)    // Hide miscellaneous status elements (trains, pickup history, death notices, etc)
#define HIDEHUD_CHAT                (1 << 7)    // Hide all communication elements (saytext, voice icon, etc)
#define HIDEHUD_CROSSHAIR           (1 << 8)    // Hide crosshairs
#define HIDEHUD_VEHICLE_CROSSHAIR   (1 << 9)    // Hide vehicle crosshair
#define HIDEHUD_INVEHICLE           (1 << 10)
#define HIDEHUD_BONUS_PROGRESS      (1 << 11)    // Hide bonus progress display (for bonus map challenges) 
PHP Code:
int bits GetEntProp(clientProp_Send"m_iHideHUD");
SetEntProp(clientProp_Send"m_iHideHUD"bits HIDEHUD_CROSSHAIR); 
You can try the above code with "player_team" event if you generally want this applied to every player all the time.
Note that a small delay to execute is needed, means that you cannot do that right in "player_team". For delay functions, either RequestFrame or "CreateTimer" can suffice, up to decisions.
Forgetest is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 08-20-2022 , 15:22   Re: [L4D2]Is there any way to hide crosshair by server?
Reply With Quote #6

I test this too,it only hide the melee_crosshair.

Code:
#define HIDE_WEAPON (1<<8)
SetEntProp(client,Prop_Send,"m_iHideHUD",GetEntProp(client,Prop_Send,"m_iHideHUD")|HIDE_WEAPON);
LinLinLin is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 08-20-2022 , 15:27   Re: [L4D2]Is there any way to hide crosshair by server?
Reply With Quote #7

I notice that when you face an entity which can be selected ,the crosshair will disappear.
Maybe some server func control it hahaha.

Last edited by LinLinLin; 08-20-2022 at 15:27.
LinLinLin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode