[HELP] Extra Damage for the head!
#1

So, based on a post that I saw on forums plus my noob knowledge about pawn I ended up with that:

Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
    {
    new Float:armour;
    SetPlayerArmour(playerid,-85);
    GetPlayerArmour(playerid, armour);
    if(playerid,armour == 0) SetPlayerHealth(playerid,-85);
    }
The code should work like that:
If the player hits the head with a rifle, its going to cause 85 damage, but instead, if someone hits the other player's head, it just resplenish the armour, and if the bullet hit the body it just go trough the armour and causes 85 damage to the health.

If someone can find out what's wrong, I would thank you !
Reply
#2

Quote:
Originally Posted by Dragonic
Посмотреть сообщение
So, based on a post that I saw on forums plus my noob knowledge about pawn I ended up with that:

Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
    {
    new Float:armour;
    SetPlayerArmour(playerid,-85);
    GetPlayerArmour(playerid, armour);
    if(playerid,armour == 0) SetPlayerHealth(playerid,-85);
    }
The code should work like that:
If the player hits the head with a rifle, its going to cause 85 damage, but instead, if someone hits the other player's head, it just resplenish the armour, and if the bullet hit the body it just go trough the armour and causes 85 damage to the health.

If someone can find out what's wrong, I would thank you !

try this

Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
    {
    new Float:armour;
    GetPlayerArmour(playerid, armour);
     SetPlayerArmour(playerid,armour-85);
     if(playerid,armour == 0) SetPlayerHealth(playerid,-85);
    }
Reply
#3

Hmm, I'll try that one when my friend logs in (can't test alone).
Thanks anyway
Reply
#4

Send me Your Server ip in pm I would help you.
Reply
#5

I've made a few tests with my friend:

The body damage is OK but with the Rifle the 1st hit does 85 damage to the body, the second replenishes the armour and lowers the health a bit, then if I land a third bullet on the enemy head he dies. I should kill with 3 headshots but its not synced if you get my point.

I also tested with Eagle and M4. Eagle is doing normal damage to the Armour but when the armour is gone, it hitkill even with 100 health (It should cause 50 damage per bullet), M4 is having the same issue, it hitkill after consume the Armour...
Reply
#6

Quote:
Originally Posted by Dragonic
Посмотреть сообщение
Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
    {
    new Float:armour;
    SetPlayerArmour(playerid,-85);
    GetPlayerArmour(playerid, armour);
    if(playerid,armour == 0) SetPlayerHealth(playerid,-85);
    }
This code in making no since for me, you're checking if he shot the other with a rife in the head then

Set the armour to -85(why?, it doesn't decrease it by 85, it SETS it to -85"if I'm not wrong")
then get his armour(which you just set "-85")
then i don't know what that lines means "if(playerid,armour == 0)"

Try to explain what're you trying to do and I'll help you
Reply
#7

pawn Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
    {
        new Float:armour;
        GetPlayerArmour(playerid,armour);
        if(armour > 0)
        {
            SetPlayerArmour(playerid,armour-85);
        }
        if(armour == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid,health);
            SetPlayerHealth(playerid,health-85);
        }
    }
Try this...
Reply
#8

i'm using the code from Mbilal which a little different than mine but it still not perfect.
What I had in mind is to buff the weapon damage if its a headshot, but I want to make the system recognize if the player have an armour or not so it'll first take down the armour then the health...

Get the point?
Reply
#9

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
This code in making no since for me, you're checking if he shot the other with a rife in the head then

Set the armour to -85(why?, it doesn't decrease it by 85, it SETS it to -85"if I'm not wrong")
then get his armour(which you just set "-85")
then i don't know what that lines means "if(playerid,armour == 0)"

Try to explain what're you trying to do and I'll help you
I was wondering the exact same thing..
Reply
#10

Edited mine a bit, but try that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)