Results 1 to 4 of 4

Thread: need help pls - mapvote / iprintlnbold / assist kills

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    About the assist kills, wrote that script once for zombots:

    on player damage:
    PHP Code:
    zombie utils\assist::ASSIST_add(iDamageeAttacker); 
    on player kill:
    PHP Code:
        // zombie ASSIST_do_scores();
        
        
    player zombie;
        if (
    isDefined(player.assistKills))
        {

            
    helpingHands player.assistKills.size 1;

            for (
    i=0i<player.assistKills.sizei++)
            {
                
    // assist-killer leaved...
                
    if (!isDefined(player.assistKills[i].causer))
                    continue;

                
    partDamage player.assistKills[i].damage;
                
    full player.maxhealth;
                
    percent partDamage/(full/100);

                
    //moneyForKill = mod\config::CONFIG_moneyForKill();
                
    moneyForKill zombie.points;
                
    coins moneyForKill * (percent/100);

                
    percent int(percent);
                
    coins int(coins);

                
    //player.assistKills[i].causer mod\player::addMoney(coins); // looks ugly with 1.33333, but better round it in hud-management...
                
    player.assistKills[i].causer.score++;
                
    player.assistKills[i].causer utils\money::addMoney(coins);
                
                
    //player.assistKills[i].causer iprintlnbold("^1" + percent + " ^1P^7ercent ^1o^7f ^1" + player.maxhealth + " ^1H^7ealth ^7= ^1" + coins + "^7$");
                /*
                if (player.assistKills[i].causer == attacker)
                {
                    //if (player.assistKills[i].causer isKung())
                        player.assistKills[i].causer iprintlnbold("^1K^7ILL ^1(^7"+percent+" ^1P^7ercent^1)^7! ^1H^7elping ^1H^7ands: "+helpingHands + " ^1C^7oins: ^1+^7"+coins);
                } else {
                    //if (player.assistKills[i].causer isKung())
                        player.assistKills[i].causer iprintlnbold("^1A^7SSIST-^1K^7ILL ^1(^7"+percent+" ^1P^7ercent^1)^7! ^1H^7elping ^1H^7ands: "+helpingHands + " ^1C^7oins: ^1+^7"+coins);
                }
                */
            
    }
            
    // clear them...
            
    player.assistKills undefined;
        } 
    utils/assist.gsc
    PHP Code:
    ASSIST_add(iDamageeAttacker)
    {
        
    entity self;
        
        if (
    entity.health <= 0)
        {
            
    //iprintln("entity.health <= 0");
            
    return;
        }

        
    // example 1:
        // health of zombie = 200/400
        // damage = 100
        // causedDamage = 100

        // example 2:
        // health of zombie = 200/400
        // damage = 300
        // causedDamage = 200

        
    causedDamage iDamage;
        if (
    causedDamage entity.health)
            
    causedDamage entity.health;

        
    //kung iprintln("causedDamage="+causedDamage + " iDamage="+iDamage + " enemyHealth="+player.health);

        
    if (!isDefined(entity.assistKills))
            
    entity.assistKills = [];

        
    // caused the eAttacker already an assistKill?
        
    causedAssistKill = -1// -1 = no assist kill
        
    for (i=0i<entity.assistKills.sizei++)
        {
            if (!
    isDefined(entity.assistKills[i].causer)) // left server
                
    continue;
            if (
    entity.assistKills[i].causer != eAttacker)
                continue;
            
    causedAssistKill i;
            break;

        }

        if (
    causedAssistKill == -1)
        {
            
    assistKill spawnStruct();
            
    assistKill.causer eAttacker;
            
    assistKill.damage causedDamage;
            
    entity.assistKills[entity.assistKills.size] = assistKill;
            
    //iprintlnbold("New Assistkill! Damage: "+causedDamage);
        
    } else {
            
    entity.assistKills[i].damage += causedDamage;
            
    //iprintlnbold("Added Damage! Now: "+entity.assistKills[i].damage);
        
    }

    timescale 0.01

  2. The Following 3 Users Say Thank You to kung foo man For This Useful Post:

    Ni3ls (31st January 2015),ORDI (7th February 2015),voron00 (22nd March 2016)

Posting Permissions

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