Help a bit? - 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 a bit? (
/showthread.php?tid=368975)
Help a bit? -
N0FeaR - 15.08.2012
I trying to make so weapons take more damnge but wont work
pawn Код:
}
stock DoDamage(playerid, targetid, bodypart, weaponid)
{
static
bodyparttext[16],
string[68],
DamageType,
Float:IncreasedDamage,
Float:health,
Float:armour;
GetPlayerHealth(targetid, health);
GetPlayerArmour(targetid, armour);
GetWeaponNameEx(weaponid, string, sizeof(string));
switch(bodypart) {
case 1: bodyparttext = "BODY_PART_HEAD",DamageType = 1;
case 2: bodyparttext = "BODY_PART_TORSO",DamageType = 2;
case 3: bodyparttext = "BODY_PART_LEGS",DamageType = 3; }
switch(weaponid) {
case 23: IncreasedDamage = SDPistolDMG; // SD Pistol
case 24: IncreasedDamage = DeagleDMG; // Desert Eagle
case 25: IncreasedDamage = ShotgunDMG; // Shotgun
case 28: IncreasedDamage = UziDMG; // UZI
case 30: IncreasedDamage = AK47DMG; // AK47
case 31: IncreasedDamage = M4A1DMG; // M4A1
case 32: IncreasedDamage = Tec9DMG; // Tec9
case 33: IncreasedDamage = CountryRifleDMG; // Country Rifle
}
if(armour > 10) {
if(DamageType == 1) { IncreasedDamage += 8.6; }
else if(DamageType == 2) { IncreasedDamage += 6.6; }
else if(DamageType == 3) { IncreasedDamage += 4.5; }
SetPlayerArmour(targetid, armour-IncreasedDamage); }
else if(health > 13) {
if(DamageType == 1) { IncreasedDamage += 50.0; }
else if(DamageType == 2) { IncreasedDamage += 50.0; }
else if(DamageType == 3) { IncreasedDamage += 50.0; }
SetPlayerHealth(targetid, health-IncreasedDamage); }
if(health-IncreasedDamage == 0 || health-IncreasedDamage < 0) { Died[targetid] = 1; }
return 1;
}
Re: Help a bit? -
SaYrOn - 15.08.2012
How do you check where the player is aiming at?
You should use this include, I think
https://sampforum.blast.hk/showthread.php?tid=195439.
And smth like this:
Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
new Float:Health[2];
GetPlayerHealth(Target, Health[0]);
GetPlayerArmour(Target,Health[1]);
if(GetPlayerWeapon(Shooter) == 24)
{
if(H[1] > 0) return SetPlayerArmour(Target,0);
SetPlayerHealth(Target, H[0]-100);
}
}
Hope that helps
Re: Help a bit? -
JaKe Elite - 15.08.2012
that include was made during 0.3a where OnPlayerGiveDamage was not make.
i recommend you to use OnPlayerGiveDamage. (since we are on 0.3e now)
Re: Help a bit? -
SaYrOn - 15.08.2012
Oh, right, completely forgot about it. But the idea is same.