
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!
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>)
Syntax: Select all
<PlayerEntity>.m_iTeamNum = <value>
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.
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)
Return to “Plugin Development Support”
Users browsing this forum: No registered users and 105 guests