Radar possebilities?

Please post any questions about developing your plugin here. Please use the search function before posting!
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Radar possebilities?

Postby Tuck » Sun May 11, 2014 11:28 am

Is there anyway to call a method, for showing a enemy on the radar? such as a decoy would do

I'm thinking there might be some engine method to do so

thanks in advance :)
-Tuck
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Mon May 12, 2014 10:14 am

Something like this should works:

Syntax: Select all

from entities import EntityGenerator
from filters.players import PlayerIter
from listeners.tick import Tick

for player_manager in EntityGenerator('cs_player_manager'):
break

@Tick
def tick_listener():
for index in PlayerIter('alive'):
player_manager.set_prop_int('m_bPlayerSpotted.%03d' % index, True)
User avatar
devilsnake88
Junior Member
Posts: 7
Joined: Mon Feb 18, 2013 4:03 pm
Contact:

Postby devilsnake88 » Mon May 12, 2014 8:15 pm

It's awesome! And it's give me some scripts ideas ^^
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Fri Oct 10, 2014 6:31 am

Syntax: Select all

@Tick
def tick_listener():
for index in PlayerIter('alive'):
player_manager.set_prop_int('m_bPlayerSpotted.%03d ' % index, False)


is this how to disable radar??
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Fri Oct 10, 2014 7:02 am

To disable the radar on CS:GO check out the following.

Syntax: Select all

from filters.players import PlayerIter

HIDEHUD_RADAR = 1 << 12

@Event
def round_start(game_event):
# Loop through all living players...
for edict in PlayerIter('alive', return_types=['edict']):

# Get the player's hidden huds...
hidehud = edict.get_prop_int('m_iHideHud')

# Is the player already have the radar disabled?
if hidehud & HIDEHUD_RADAR:

# If so, no need to go further...
continue

# Hide the player's radar...
edict.set_prop_int('m_iHideHud', hidehud | HIDEHUD_RADAR)
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Fri Oct 10, 2014 7:19 am

L'In20Cible wrote:To disable the radar on CS:GO check out the following.

Syntax: Select all

from filters.players import PlayerIter

HIDEHUD_RADAR = 1 << 12

@Event
def round_start(game_event):
# Loop through all living players...
for edict in PlayerIter('alive', return_types=['edict']):

# Get the player's hidden huds...
hidehud = edict.get_prop_int('m_iHideHud')

# Is the player already have the radar disabled?
if hidehud & HIDEHUD_RADAR:

# If so, no need to go further...
continue

# Hide the player's radar...
edict.set_prop_int('m_iHideHud', hidehud | HIDEHUD_RADAR)


thank you! really need to learn bout bitwise opertaions
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Fri Oct 10, 2014 7:31 am

I may add that this won't work on CS:S, tho. While this flag is available, it is just ignored when rendering the radar. They did fix it on CS:GO (at least, it was when I was testing a while back). On CS:S, it requires to hack a bit.
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Fri Oct 10, 2014 9:08 am

L'In20Cible wrote:I may add that this won't work on CS:S, tho. While this flag is available, it is just ignored when rendering the radar. They did fix it on CS:GO (at least, it was when I was testing a while back). On CS:S, it requires to hack a bit.


i wanted to know for csgo so you read my mind!
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Wed Jun 03, 2015 9:02 pm

L'In20Cible wrote:Something like this should works:

Syntax: Select all

from entities import EntityGenerator
from filters.players import PlayerIter
from listeners.tick import Tick

for player_manager in EntityGenerator('cs_player_manager'):
break

@Tick
def tick_listener():
for index in PlayerIter('alive'):
player_manager.set_prop_int('m_bPlayerSpotted.%03d' % index, True)


Tried updating this piece of code, can't get it to work.

Syntax: Select all

from entities.entity import BaseEntity
from entities import EntityGenerator
from filters.players import PlayerIter
from listeners import Tick

for edict in EntityGenerator('cs_player_manager'):
player_manager = BaseEntity(index_from_edict(edict))
break


@Tick
def tick_listener():
for index in PlayerIter('alive', return_types='index'):
player_manager.set_key_value_bool("m_bPlayerSpotted.{0:03d}".format(index), True)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Jun 03, 2015 9:07 pm

You want set_property_bool not set_key_value_bool. That was part of the entities changes when we merged SendProps with DataMaps.

Edit: also, you want Entity and not BaseEntity.
Edit2: though, you could also use EntityIter instead of using EntityGenerator directly:
http://wiki.sourcepython.com/pages/filters.entities
Image
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Wed Jun 03, 2015 9:58 pm

Thanks, this ended up working:

Syntax: Select all

for player_manager in EntityIter('cs_player_manager', return_types="entity"):
break


@Tick
def tick_listener():
for index in PlayerIter('alive', return_types='index'):
player_manager.set_property_int("m_bPlayerSpotted.{0:03d}".format(index), 1)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Jun 03, 2015 10:09 pm

Oh yeah, int not bool. That is a SendProp and there is no boolean SendPropType.
Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Thu Jun 04, 2015 12:13 pm

L'In20Cible wrote:To disable the radar on CS:GO check out the following.

Syntax: Select all

from filters.players import PlayerIter

HIDEHUD_RADAR = 1 << 12

@Event
def round_start(game_event):
# Loop through all living players...
for edict in PlayerIter('alive', return_types=['edict']):

# Get the player's hidden huds...
hidehud = edict.get_prop_int('m_iHideHud')

# Is the player already have the radar disabled?
if hidehud & HIDEHUD_RADAR:

# If so, no need to go further...
continue

# Hide the player's radar...
edict.set_prop_int('m_iHideHud', hidehud | HIDEHUD_RADAR)


OT question: What is this exactly?

Syntax: Select all

HIDEHUD_RADAR = 1 << 12

# ....

hidehud & HIDEHUD_RADAR
hidehud | HIDEHUD_RADAR
The << and | symbols.

I know in C++ << and >> on variables is bit shifting. How do you call that, and | & etc. in Python? :)
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Jun 04, 2015 12:24 pm

Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Thu Jun 04, 2015 12:31 pm

Thanks a bunch!
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Jun 04, 2015 12:37 pm

I should probably also mention the there is a HideHudFlags enum class in players.constants.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 32 guests