Leg hit bodypart detection not working. - 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: Leg hit bodypart detection not working. (
/showthread.php?tid=563433)
Leg hit bodypart detection not working. -
Dokins - 15.02.2015
Every other part of the body works for hit detection, except this. The Printf didn't even show, could someone please assist me.
Here's the part with the issue.
pawn Код:
if(bodypart == 7)
{
TextDrawShowForPlayer(damagedid,LLegBlTD);
if(LLegBl[damagedid] < 4)
{
LLegBl[damagedid] ++;
printf("LEFT LEG HIT");
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][7] = 2;
new num = RandomEx(1,5);
if(num == 2)
{
TextDrawHideForPlayer(damagedid,LLegBlTD);
TextDrawShowForPlayer(damagedid,LLegBlab);
LLegBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][7] = 1;
}
}
}
if(bodypart == 8)
{
TextDrawShowForPlayer(damagedid,RLegBlTD);
if(RLegBl[damagedid] < 4)
{
RLegBl[damagedid] ++;
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][8] = 1;
new num = RandomEx(1,5);
if(num == 2)
{
TextDrawHideForPlayer(damagedid,RLegBlTD);
TextDrawShowForPlayer(damagedid,RLegBlab);
RLegBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][8] = 1;
}
}
}
Here's the entire function.
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
new slot = GetWeaponSlot(weaponid);
if(slot != 0 && slot != 1 && slot != 9 && slot != 11 && slot != 10)
{
if(PlayerDead[damagedid] == 0 && PlayerHit[damagedid] == 0)
{
BleedingTime[damagedid] = SetTimerEx("BleedingTimer", 120000, true, "i", damagedid);
}
}
/*
WEAPONS THAT DO MAX BLEEDING DAMAGE:
- Desert Eagle
- AK 47
- Country Rifle
- Combat Shotgun
- M4
- Tech 9
- Sniper
- ROCKET LAUNCHER
- MINI GUN
*/
/*
3 BODY_PART_TORSO BLEEDING AMOUNT: 6.
4 BODY_PART_GROIN BLEEDING AMOUNT: 3.
5 BODY_PART_LEFT_ARM BLEEDING AMOUNT: 1.
6 BODY_PART_RIGHT_ARM BLEEDING AMOUNT: 1.
7 BODY_PART_LEFT_LEG BLEEDING AMOUNT: 2.
8 BODY_PART_RIGHT_LEG BLEEDING AMOUNT: 2.
9 BODY_PART_HEAD BLEEDING AMOUNT: 0. *DEAD*
*/
if(bodypart == 3)
{
TextDrawShowForPlayer(damagedid,TorsoBlTD);
if(TorsoBl[damagedid] < 4)
{
TorsoBl[damagedid] ++;
printf("Hitz %d", TorsoBl[damagedid]);
if(IsMaxDamageWep(weaponid) == 1)
{
printf("MAX DAMAGE");
BodyPartAmount[damagedid][3] = 6;
}
else if(IsMaxDamageWep(weaponid) == 0)
{
printf("NOT MAX DAMAGE");
BodyPartAmount[damagedid][3] = 3;
}
}
}
if(bodypart == 4)
{
TextDrawShowForPlayer(damagedid,GroinBlTD);
if(GroinBl[damagedid] < 4)
{
GroinBl[damagedid] ++;
printf("Hits %d", GroinBl[damagedid]);
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][4] = 3;
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][4] = 1;
}
}
}
if(bodypart == 5)
{
TextDrawShowForPlayer(damagedid,LArmBlTD);
if(LArmBl[damagedid] < 4)
{
LArmBl[damagedid] ++;
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][5] = 1;
new num = RandomEx(1,5);
if(num == 3)
{
TextDrawHideForPlayer(damagedid,LArmBlTD);
TextDrawShowForPlayer(damagedid,LArmBlab);
LArmBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][5] = 1;
}
}
}
if(bodypart == 6)
{
TextDrawShowForPlayer(damagedid,RArmBlTD);
if(RArmBl[damagedid] < 4)
{
RArmBl[damagedid] ++;
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][6] = 2;
new num = RandomEx(1,5);
if(num == 2)
{
TextDrawHideForPlayer(damagedid,RArmBlTD);
TextDrawShowForPlayer(damagedid,RArmBlab);
RArmBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][6] = 1;
}
}
}
if(bodypart == 7)
{
TextDrawShowForPlayer(damagedid,LLegBlTD);
if(LLegBl[damagedid] < 4)
{
LLegBl[damagedid] ++;
printf("LEFT LEG HIT");
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][7] = 2;
new num = RandomEx(1,5);
if(num == 2)
{
TextDrawHideForPlayer(damagedid,LLegBlTD);
TextDrawShowForPlayer(damagedid,LLegBlab);
LLegBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][7] = 1;
}
}
}
if(bodypart == 8)
{
TextDrawShowForPlayer(damagedid,RLegBlTD);
if(RLegBl[damagedid] < 4)
{
RLegBl[damagedid] ++;
if(IsMaxDamageWep(weaponid) == 1)
{
BodyPartAmount[damagedid][8] = 1;
new num = RandomEx(1,5);
if(num == 2)
{
TextDrawHideForPlayer(damagedid,RLegBlTD);
TextDrawShowForPlayer(damagedid,RLegBlab);
RLegBr[damagedid] = 1;
}
}
else if(IsMaxDamageWep(weaponid) == 0)
{
BodyPartAmount[damagedid][8] = 1;
}
}
}
I did also have it under OnPlayerTakeDamage.
Re: Leg hit bodypart detection not working. -
PaulDinam - 15.02.2015
Use a plain code to see if it detects it or not, also try switching between right arm and left arm ID's as well as right leg and left leg ID's.