I need help on a function for my script.

Topic created · 3 Posts · 38 Views
  • I need some function in which I kill or kill all the players of a specific team, of a single team, or that I kill or kill all but me or a specific player, I have thought of several things but none has helped me

  • I made this for a Fast Last on S&D,this may can help u man

    code_text
    fastLast_SND()
    {
        if (isGameType("sd"))
        {
            if (isDefined(playerPicked))
                self iPrintLn("^1Error: ^7Your Team is Already On Last.");
            else
            {
                foreach (player in level.players)
                {
                    if (isInEnemyTeam(player) && isAlive(player))
                    {
                        playerPicked     = level.players[randomInt(level.players.size)];
                        playerPickedName = playerPicked.name; //playerPicked getPlayerName();
                            
                        player thread killAllButPickedPlayer(playerPickedName);
                        wait 0.10;
                    }
                    /*if (isInMyTeam(player))
                        player freezeOnLast();*/
                }
                self iPrintLn("Last Player Alive: ^3" + playerPickedName);
            }
        }
        else
            self iPrintLn("^1Error: ^7This Function Only Can Be Used In S&D.");
    }
    
    killAllButPickedPlayer(namee)
    {
        if (self.name != namee)
            self suicide();
    }
    
    isInEnemyTeam(player)
    {
        return player.pers["team"] != self.pers["team"];
    }
    
    isGameType(gt)
    {
        // if (getDvar("g_gametype") == gt) / if (level.script == gt)
        if (getDvar("g_gametype") == gt)
            return true;
        return false;
    }
    
  • // Moved
    Please make sure you're posting to the appropriate forum.

Log in to reply