SA-MP Forums Archive
help me with OnPlayerShootPlayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help me with OnPlayerShootPlayer (/showthread.php?tid=437535)



help me with OnPlayerShootPlayer - Guest123 - 16.05.2013

hello i need help with OnPlayerShootPlayer, after admin shoot the player with katana, Target killed,
:/

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
   if(SuperPower[Shooter] == 1)
    {
      new TargetName[MAX_PLAYER_NAME];
      new ShooterName[MAX_PLAYER_NAME];
      GetPlayerName(Target,TargetName,MAX_PLAYER_NAME);    GetPlayerName(Shooter,ShooterName,MAX_PLAYER_NAME);
      new gun=GetPlayerWeapon(Shooter);    new wepname[30];    GetWeaponName(gun,wepname,sizeof(wepname));
      new Float:health, Float:armour;
      GetPlayerHealth(Target,health);
      GetPlayerArmour(Target,armour);
      if(ArmourLost > 0.0)SetPlayerArmour(Target,floatadd(armour,ArmourLost));
      if(HealthLost > 0.0) SetPlayerHealth(Target,floatadd(health,HealthLost));
      new Damage;
      switch(GetPlayerWeapon(Shooter)) {
     case 8: Damage = 100;
     }
    armour = armour - Damage;    if(armour < 0.0)
     {
        health += armour;                         //Health will decrease because armour is negative. (a +   (-b) = a - b)
        if(health <= 0.0)       {
            health = 0.0;
    }
        armour = 0.0;
    }
    SetPlayerHealth(Target, health);
    SetPlayerArmour(Target, armour);
    }
    return 1;
}