How to make player invisible?

Please post any questions about developing your plugin here. Please use the search function before posting!
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

How to make player invisible?

Postby 8guawong » Tue Oct 07, 2014 12:24 am

How to make player invisible?

Game: CSGO
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Tue Oct 07, 2014 5:21 am

User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Oct 07, 2014 5:59 am

There is no known way to change the alpha of a player on CS:GO. This is a limitation of the engine itself and there is nothing we can do about that. I think this is just hard-coded/handled client-side and such information is ignored to the transmited data or something like that.
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Tue Oct 07, 2014 6:20 am

In case you are looking for fully invisibility: (solutions from SM forums)
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Tue Oct 07, 2014 6:39 am

nah don't need this anymore! i was thinking of putting one bot on the server and make him invisible to solve round /map restart problem :P
no need now since L'In20Cible fixed the switch_team function :cool:
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Oct 07, 2014 6:39 am

Hedgehog wrote:
  • Set m_fEffects player prop to 32 (invisible) and m_fEffects to 129 (visible)
Well, I would not recommend hard-coding m_fEffects values. I'd rather suggest you to look at the following code.

Syntax: Select all

from constants import EntityEffects
from events import Event
from players.entity import PlayerEntity
from players.helpers import index_from_userid

@Event
def player_jump(game_event):
# Get a PlayerEntity instance of the player...
player = PlayerEntity(index_from_userid(game_event.get_int('userid')))

# Get the current player's effects...
effects = player.get_prop_int('m_fEffects')

# Is the player already visible?
if not effects & EntityEffects.NODRAW:

# Add the NODRAW effect to the player...
player.set_prop_int('m_fEffects', effects | EntityEffects.NODRAW)

# Otherwise...
else:

# Remove the NODRAW effect from the player...
player.set_prop_int('m_fEffects', effects & ~EntityEffects.NODRAW)
This is how it should be done. This will properly toggle the player invisibility without altering any other effects.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Oct 07, 2014 12:31 pm

Actually, I found this SM plugin during a search last night to try and figure this out:
https://github.com/Zipcore/Hide_And_Seek

I haven't had time to test anything with its method, as of yet, though.
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Oct 07, 2014 1:36 pm

I searched over the whole code and didn't find anything related to changing player color? :eek:
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Oct 07, 2014 1:47 pm

I believe this is where it changes the alpha:
https://github.com/Zipcore/Hide_And_Seek/blob/master/addons/sourcemod/scripting/hide_and_seek.sp#L700

It seems that it sets the RenderMode to RENDER_TRANSTEXTURE, which is 2.
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Oct 07, 2014 2:00 pm

I think it is some code for the CS:S version. I already tested all RenderModes and nothing worked.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Oct 07, 2014 3:12 pm

To make an entity completely invisible (even the weapons a player has) I hooked CBaseEntity::SetTransmit() with SPE some years ago. http://forums.eventscripts.com/viewtopic.php?f=90&t=45739&p=399762&hilit=SetTransmit#p399762

I'm pretty sure this will also work with CS:GO. And doing this with SP will be much easier. :)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Oct 07, 2014 3:15 pm

While invisible is nice, I would really like to find a way to change the player's alpha, if it is at all possible.
Image
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Tue Oct 07, 2014 6:01 pm

In case of educated guess it can be caused by game default players skins (some tricky textures etc).

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 58 guests