Weird behaviour during warmup

All other Source.Python topics and issues.
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Weird behaviour during warmup

Postby Mahi » Tue Nov 24, 2015 11:52 pm

I'm using the following plugin to test this with the latest release at this time:

Syntax: Select all

from events import Event
from players.entity import Player
from players.helpers import index_from_userid

@Event('player_death',
'player_spawn',
'player_disconnect',
'player_activate',
'player_jump')
def on_event(event):
player = Player(index_from_userid(event['userid']))
print(event.get_name(), player.userid)
Apparently whenever I change team during a warmup, it creates a new bot and immediately seems to disconnect it. If I change team again, the bots will join the server, and the userids will keep rising. Is this a bug in SP or CS:GO? Is it possible to fix this? I have tried with all three of bot_quota_mode settings and manually setting bot_quota to 0, but no effect. Also, everything seems to work just fine after the warmup has ended.

EDIT: Seems like every team change increases bot_quota by one. At first it's 0, so the first team change only quickly creates a bot and removes it. Changing a team again will increase bot_quota to 2 and then the first bot will stay on the server.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Wed Nov 25, 2015 11:05 am

The first workaround that comes to my mind is to add -nobots to the command line when you start srcds.

Also, might be related? https://forums.alliedmods.net/showthread.php?t=193691
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Wed Nov 25, 2015 12:43 pm

I moved this thread to a more appropriate section.

I actually doubt that this is a bug in SP, but if you really want to find that out, disable SP and test again.
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Wed Nov 25, 2015 12:48 pm

Yeah it seems to be a Source engine bug. Still, any possible fixes are welcome!

An other bug which I'm not sure if it's SP or Source engine: player.is_fake_client() seems to return False even on bots. Is this intended behaviour? I just ended up using player.steamid == 'BOT' for now, but took me a while to figure out why my code wasn't working.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Wed Nov 25, 2015 1:14 pm

Player.is_fake_client, is a wrapper around PlayerInfo.is_fake_client which simply check if the FL_FAKECLIENT flag is set on the player. However, since anyone (plugins, scripts, etc.) can change players' flags, that method is not 100% accurate - and yes, checking against the SteamID is probably the best way to go. PlayerInfo.is_dead is also returning false results on multiplayer games, this is some old checks from HL2 which return True/False based on player being in spectator team.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Wed Nov 25, 2015 1:16 pm

Mahi wrote:An other bug which I'm not sure if it's SP or Source engine: player.is_fake_client() seems to return False even on bots. Is this intended behaviour? I just ended up using player.steamid == 'BOT' for now, but took me a while to figure out why my code wasn't working.
Does that always happen or only if you are using your EasyPlayer.paralyse funtion? I noticed that it's not implemented properly. Instead of this[PYTHON]self.flags %= ~PlayerStates.FROZEN[/PYTHON]it should look like this:[PYTHON]self.flags &= ~PlayerStates.FROZEN[/PYTHON]
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Nov 25, 2015 1:18 pm

That also can't be an SP issue as it just wraps IPlayerInfo::IsFakeClient directly:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/players/players_wrap.cpp#L128

I have never had an issue with it before, though. We had an issue with IPlayerInfo:IsPlayer which is why we now use IPlayerInfo:IsFakeClient for both True and False in PlayerIter:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/packages/source-python/filters/players.py#L92

*Edit: damn, beat twice...
*Edit2: having read the other replies, I do remember having a similar issue previously that was 100% my fault from changing player flags.
Image
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Wed Nov 25, 2015 3:02 pm

I tested the player.is_fake_client() a little more, and figured that it's false for bots only when they join the server, after that it works fine. So when the player_spawn triggers before bot is even in on any team, that's when player.is_fake_client() is unreliable. So probably not SP related either.

L'In20Cible wrote:Player.is_fake_client, is a wrapper around PlayerInfo.is_fake_client which simply check if the FL_FAKECLIENT flag is set on the player. However, since anyone (plugins, scripts, etc.) can change players' flags, that method is not 100% accurate - and yes, checking against the SteamID is probably the best way to go. PlayerInfo.is_dead is also returning false results on multiplayer games, this is some old checks from HL2 which return True/False based on player being in spectator team.
Thanks for all the info, I'll be using the steamID check from now on.

Ayuto wrote:Does that always happen or only if you are using your EasyPlayer.paralyse funtion? I noticed that it's not implemented properly. Instead of this[PYTHON]self.flags %= ~PlayerStates.FROZEN[/PYTHON]it should look like this:[PYTHON]self.flags &= ~PlayerStates.FROZEN[/PYTHON]
I wasn't using EasyPlayer at all so it was completely unrelated, but thanks anyways, I've updated the issue! :)

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests