// IW6 GSC SOURCE
// Generated by https://github.com/xensik/gsc-tool

isplayerinlaststand( var_0 )
{
    return isdefined( var_0.laststand ) && var_0.laststand;
}

isonhumanteam( var_0 )
{
    return var_0.team == level.playerteam;
}

getnumplayers()
{
    var_0 = 0;

    if ( !isdefined( level.players ) )
        return 0;

    foreach ( var_2 in level.players )
    {
        if ( isonhumanteam( var_2 ) )
            var_0++;
    }

    return var_0;
}

isspecialround( var_0 )
{
    if ( !isdefined( var_0 ) )
        var_0 = level.currentroundnumber;

    if ( !level.enablespecialround )
        return 0;

    if ( var_0 % 5 == 1 )
        return 1;

    return 0;
}

isdoground()
{
    return level.chancetospawndog > 0;
}

showteamsplashhorde( var_0 )
{
    foreach ( var_2 in level.players )
    {
        if ( isonhumanteam( var_2 ) && maps\mp\_utility::isreallyalive( var_2 ) )
            var_2 thread maps\mp\gametypes\_hud_message::splashnotify( var_0 );
    }
}

hasagentsquadmember( var_0 )
{
    var_1 = 0;

    if ( isagent( var_0 ) )
        return var_1;

    foreach ( var_3 in var_0.pers["killstreaks"] )
    {
        if ( isdefined( var_3 ) && isdefined( var_3.streakname ) && var_3.available && var_3.streakname == "agent" )
        {
            var_1 = 1;
            break;
        }
    }

    return var_1;
}

getplayerweaponhorde( var_0 )
{
    var_1 = var_0 getcurrentprimaryweapon();

    if ( isdefined( var_0.changingweapon ) )
        var_1 = var_0.changingweapon;

    if ( !maps\mp\gametypes\_weapons::isprimaryweapon( var_1 ) )
        var_1 = var_0 common_scripts\utility::getlastweapon();

    if ( !var_0 hasweapon( var_1 ) )
        var_1 = var_0 maps\mp\killstreaks\_killstreaks::getfirstprimaryweapon();

    return var_1;
}

playsoundtoallplayers( var_0 )
{
    level endon( "game_ended" );

    foreach ( var_2 in level.players )
    {
        if ( !maps\mp\_utility::isreallyalive( var_2 ) )
            continue;

        if ( !isonhumanteam( var_2 ) )
            continue;

        var_2 playsoundtoplayer( var_0, var_2 );
    }
}

refillammohorde( var_0 )
{
    var_1 = var_0 getweaponslistall();

    foreach ( var_3 in var_1 )
    {
        var_0 givemaxammo( var_3 );

        if ( var_3 == level.intelminigun )
        {
            var_4 = weaponclipsize( level.intelminigun );
            var_0 setweaponammoclip( level.intelminigun, var_4 );
        }
    }
}

awardhordekill( var_0 )
{
    var_0 maps\mp\gametypes\_persistence::statsetchild( "round", "squardKills", var_0.killz + 1 );
    var_0.killz = int( min( var_0.killz + 1, 999 ) );
    var_0.kills = var_0.killz;
    var_0 maps\mp\_utility::setpersstat( "hordeKills", var_0.killz );
}

awardhorderevive( var_0 )
{
    var_0 maps\mp\gametypes\_persistence::statsetchild( "round", "squardRevives", var_0.numrevives + 1 );
    var_0.numrevives = int( min( var_0.numrevives + 1, 999 ) );
    var_0.assists = var_0.numrevives;
    var_0 maps\mp\_utility::setpersstat( "hordeRevives", var_0.numrevives );
}

awardhordecrateused( var_0 )
{
    var_0 maps\mp\gametypes\_persistence::statsetchild( "round", "squardCrates", var_0.numcrtaescaptured + 1 );
    var_0.numcrtaescaptured = int( min( var_0.numcrtaescaptured + 1, 999 ) );
    var_0 maps\mp\_utility::setextrascore0( var_0.numcrtaescaptured );
    var_0 maps\mp\_utility::setpersstat( "hordeCrates", var_0.numcrtaescaptured );
}

awardhorderoundnumber( var_0, var_1 )
{
    var_0 maps\mp\gametypes\_persistence::statsetchild( "round", "sguardWave", var_1 );
    var_0 maps\mp\_utility::setpersstat( "hordeRound", var_1 );
}

awardhordweaponlevel( var_0, var_1 )
{
    var_0 maps\mp\gametypes\_persistence::statsetchild( "round", "sguardWeaponLevel", var_1 );
    var_0 maps\mp\_utility::setpersstat( "hordeWeapon", var_1 );
}
