Hey guys,
I got a few things I'd like to know:
1- How can we change players teams?
2- Does it kill the player?
3- Does it save the players score?
Thanks in advance,
SkinN!
Few questions
Syntax: Select all
# all three of these are exactly the same thing
# they kill the player
<PlayerEntity>.set_team(<value>)
<PlayerEntity>.team = <value>
<PlayerInfo>.change_team(<value>)
# These are also the same thing, but different from the first set
<PlayerEntity>.SetTeam(<value>)
<PlayerEntity>.InputSetTeam(<value>)
You can also set the offset directly:
Syntax: Select all
<PlayerEntity>.m_iTeamNum = <value>
If you want, you can find the signature for CCSPlayer::SwitchTeam, which does not kill the player and has no side effects other than a message is printed to chat about the team switch. You can also probably hook the usermessage and make sure that specific one is never printed.
You already can with what I last mentioned in my last post:
We already have the CBasePlayer::ChangeTeam signature for CSGO, so that is already possible with that game. Though, there are planned changes within the memory and entities packages as to how we handle these. Once those changes are made, we will look to adding that same dynamic function for more games/engines. We will leave the "hook the usermessage" part up to individual scripts, though, as that is not something the plugin should handle on its own.satoon101 wrote:If you want, you can find the signature for CCSPlayer::SwitchTeam, which does not kill the player and has no side effects other than a message is printed to chat about the team switch. You can also probably hook the usermessage and make sure that specific one is never printed.
I just pushed the changes I was mentioning to the entities/memory packages. I also tested CBasePlayer::ChangeTeam for CSGO, and it seems if you set the second boolean argument to True, the message is not sent to chat. If the second boolean argument is False, the message will be printed.
two and four both showed messages, while one and three did not.
I will test this out on CS:S and other OrangeBox games when I get that signature for them, as well.
Syntax: Select all
from conversions_c import index_from_userid
from events import Event
from players.entity import PlayerEntity
@Event
def player_say(game_event):
player = PlayerEntity(index_from_userid(game_event.get_int('userid')))
text = game_event.get_string('text')
if text == 'one':
player.switch_team(5 - player.team, True, True)
if text == 'two':
player.switch_team(5 - player.team, True, False)
if text == 'three':
player.switch_team(5 - player.team, False, True)
if text == 'four':
player.switch_team(5 - player.team, False, False)
two and four both showed messages, while one and three did not.
I will test this out on CS:S and other OrangeBox games when I get that signature for them, as well.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 53 guests