Results 1 to 3 of 3

Thread: 1 sniper

  1. #1
    ... connecting
    Join Date
    Apr 2021
    Posts
    3
    Thanks
    0
    Thanked 2 Times in 2 Posts

    1 sniper

    How can I make there is only one sniper per team?
    example: axis only a kar98ksniper and if a player select the sniper (in addition to the one who already has it) be assigned another weapon (kar98k)
    Thanksss

  2. The Following User Says Thank You to mateocjs For This Useful Post:

    kung foo man (18th May 2021)

  3. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    455
    Thanks
    79
    Thanked 120 Times in 99 Posts
    a lot of nuances, mode and so on, how people choose weapons, once or each (as an example).

    default _weapons.gsc:
    PHP Code:
    restrictWeaponByServerCvars(response)
    {
        
    SNIPER_LIMIT 1;
        
        if (!
    isDefined(level.snipers_list))
            
    level.snipers_list = [];
        
        if (!
    isDefined(level.snipers_list[self.pers["team"]]))
            
    level.snipers_list[self.pers["team"]] = 0;
        
        if (!
    isDefined(self.isSniper))
            
    self.isSniper false;
        
        
    /* other code */
        
        
    case "kar98k_sniper_mp":
            
            if(!
    getcvarint("scr_allow_kar98ksniper") || (level.snipers_list[self.pers["team"]] > SNIPER_LIMIT && !self.isSniper))
                
    response "restricted";
            else
            {
                
    level.snipers_list[self.pers["team"]]++;
                
    self.isSniper true;
            }
            break;
        
        
    /* other code */
        
        
    if (response != "restricted" && response != "kar98k_sniper_mp" && self.isSniper)
        {
            
    level.snipers_list[self.pers["team"]]--;
            
    self.isSniper false;
        }
        
        
    /* other code */
    }

    codecallback_playerDisconnect()
    {
        
    /* other code */
        
        
    if (self.isSniper)
            
    level.snipers_list[self.pers["team"]]--;
        
        
    /* other code */

    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  4. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (18th May 2021)

  5. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,675
    Thanks
    17
    Thanked 1,012 Times in 636 Posts
    Dont forget to clean up the list upon sniper joining spec and/or on sniper joining other team/autobalance.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (18th May 2021)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •