AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Hide Knife, Keep Crosshair (https://forums.alliedmods.net/showthread.php?t=306872)

Akitake 04-17-2018 13:02

[CS:GO] Hide Knife, Keep Crosshair
 
Hi,

As the title says I want to have it where when the players spawn, they get stripped of all their weapons including the knife, but have the choice to keep their crosshair or not (for surfing)


I have tried many ways to "remove" the knife, teleporting it away, destroying it, dropping it, set its alpha to 0, change its render mode, nothing seems to work.
Getting rid of the viewmodel is the closest I can get to what I want, but even then you can hear the knife sound when clicking.

I even tried to maybe add just a dot in the middle of the screen for every client using r_screenoverlay but that isn't very elegant.


Any idea on how to do this ? It would be greatly appreciated ! :)

Indarello 04-17-2018 15:13

Re: [CS:GO] Hide Knife, Keep Crosshair
 
Code:

SetEntProp(client_index, Prop_Send, "m_iHideHUD", GetEntProp(client_index, Prop_Send, "m_iHideHUD") | HIDEHUD_WEAPONSELECTION);
RemovePlayerItem(weapons...)

If dont work on player_spawn try timer
If you dont have crosshair , you can switch to spawned weapon with 0 ammo
Code:

new weapon = GivePlayerItem(client, "weapon_usp_silencer");
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", 0);
SetEntProp(weapon, Prop_Send, "m_iClip1", 0);

give weapon without ammo work only with timer after player_spawn

Akitake 04-18-2018 03:24

Re: [CS:GO] Hide Knife, Keep Crosshair
 
Quote:

Originally Posted by Indarello (Post 2588162)
Code:

SetEntProp(client_index, Prop_Send, "m_iHideHUD", GetEntProp(client_index, Prop_Send, "m_iHideHUD") | HIDEHUD_WEAPONSELECTION);
RemovePlayerItem(weapons...)


I don't see how that's any different than having "mp_drop_knife_enable 1", no crosshair, no knife.

Quote:

Originally Posted by Indarello (Post 2588162)
Code:

new weapon = GivePlayerItem(client, "weapon_usp_silencer");
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", 0);
SetEntProp(weapon, Prop_Send, "m_iClip1", 0);


Again, I asked for the player to not see a weapon in his viewmodel, basically this is for a surfing server where you can't kill/be killed anyways. I just want nothing obstructing the surfer's view except his crosshair if he decides to have it. I know it's possible, I've seen it done.
I don't care how the player looks to other players, if it looks like he still has a knife or not, I just want everyone's own fps view to not have anything in it.

PS: Yes, I have tried both code snippets out before saying they're not what I want.

Indarello 04-18-2018 09:05

Re: [CS:GO] Hide Knife, Keep Crosshair
 
Quote:

Originally Posted by Akitake (Post 2588276)
I don't see how that's any different than having "mp_drop_knife_enable 1", no crosshair, no knife.



Again, I asked for the player to not see a weapon in his viewmodel, basically this is for a surfing server where you can't kill/be killed anyways. I just want nothing obstructing the surfer's view except his crosshair if he decides to have it. I know it's possible, I've seen it done.
I don't care how the player looks to other players, if it looks like he still has a knife or not, I just want everyone's own fps view to not have anything in it.

PS: Yes, I have tried both code snippets out before saying they're not what I want.

Please make screenshoot what you want, on server which existed and make screenshoot what my code make

Akitake 04-18-2018 15:06

Re: [CS:GO] Hide Knife, Keep Crosshair
 
What I want

• No weapons on screen.
• Crosshair appearing in the middle.

Hide hud.. technique?

This is basically like enabling "mp_drop_knife_enable 1" in game, it just allows for a smooth drop of the knife, but it doesn't show the crosshair.

Code: https://hastebin.com/qerudijado.cpp

Screenshot: https://i.imgur.com/vU9VaeK.jpg



USP Proposed Technique's

The code does what you'd expect it to, allows you to drop your knife then replaces it with a 0 bullet pistol, but that's not what I asked for.

Code: https://hastebin.com/dazacazepo.cpp

Screenshot: https://i.imgur.com/J6orCQa.jpg

xines 04-18-2018 15:40

Re: [CS:GO] Hide Knife, Keep Crosshair
 
PHP Code:

SetEntProp(clientProp_Send"m_bDrawViewmodel"0); 

Pretty sure this is what you are fishing for.

Mitchell 04-18-2018 15:42

Re: [CS:GO] Hide Knife, Keep Crosshair
 
Why not just give players their knives and allow them to hide the view model?
weapon_reticle_knife_show 1

Indarello 04-18-2018 16:18

Re: [CS:GO] Hide Knife, Keep Crosshair
 
I don't see hidehud in code where you give pistol
And where is screenshoot of what you want on server where it existed


All times are GMT -4. The time now is 07:54.

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