Example #1
0
    def client_command(self, command, server_side=False):
        """Execute a command on the client.

        :param str command: The command to execute.
        :param bool server_side: If True the command will be emulated by the
            server.
        """
        engine_server.client_command(self.edict, command, server_side)
Example #2
0
    def client_command(self, command, server_side=False):
        """Execute a command on the client.

        :param str command: The command to execute.
        :param bool server_side: If True the command will be emulated by the
            server.
        """
        engine_server.client_command(self.edict, command, server_side)
Example #3
0
def sp_slay(source, command):
    if command.get_arg_count() == 1:
        source.message("c=(white)[c=(purple)SPc=(white)] Usage: $c=(purple)sp_slay $c=(white)<name|#userid|@filter>")
        return CommandReturn.BLOCK
    targets = target_filter(command[1], source.index)
    if len(targets) == 0:
        source.message("c=(white)[c=(purple)SPc=(white)] No Targets found.")
    else:
        for target in targets:
            engine_server.client_command(edict_from_userid(userid_from_index(target)), "kill", True)
            message_client(target, "You have been slayed.")
        source.message("c=(white)[c=(purple)SPc=(white)] Slayed " + str(len(targets)) + " players.")
    return CommandReturn.BLOCK
Example #4
0
    def hero(self, hero):
        """Setter for player's current hero.

        Makes sure player owns the hero and saves his current hero to
        the database before switching to the new one.

        Args:
            hero: Hero to switch to

        Raises:
            ValueError: Hero not owned by the player
        """

        # Make sure player owns the hero
        if hero not in self.heroes:
            raise ValueError('Hero {cid} not owned by {steamid}.'.format(
                cid=hero.cid, steamid=self.steamid
            ))

        # Make sure the hero is different than player's current hero
        if hero == self.hero:
            return

        # If player has a current hero
        if self.hero:

            # Save current hero's data
            save_hero_data(self.steamid, self.hero)

            # Destroy current hero's items
            for item in self.hero.items:
                if not item.permanent:
                    self.hero.items.remove(item)

            # Slay the player
            engine_server.client_command(self.edict, 'kill', True)

        # Change to the new hero
        _player_data[self.userid]['hero'] = hero

        # Reset current restrictions
        _player_data[self.userid]['weapons'].clear()
Example #5
0
def client_command(userid, cmd) -> None:
    engine_server.client_command(edict_from_userid(userid), cmd)
Example #6
0
    def client_command(self, command, server_side=False):
        """Execute a command on the client.

        If <server_side> is True, the command will be emulated by the server.
        """
        engine_server.client_command(self.edict, command, server_side)
Example #7
0
def _displayScreen(screen):   
    for edict in list(PlayerIter('all', return_types='edict')):
        engine_server.client_command(edict, 'r_screenoverlay ' + screen)