SA-MP Forums Archive
HELP:Headshot for only head! - 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:Headshot for only head! (/showthread.php?tid=580134)



HELP:Headshot for only head! - Mijata - 02.07.2015

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid,bodypart)
{
if(issuerid != INVALID_PLAYER_ID)
    {
if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
 {
if((weaponid == 34 || weaponid == 33))
                {
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid, "~r~Head shot!", 3000, 3);
GameTextForPlayer(playerid, "~r~Head shot!", 3000, 3);
                }
else return PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
}else {GameTextForPlayer(issuerid, "~r~Team killing is not allowed!", 3000, 3);}
}
return 0;
}
headshot is not only for head ??


Re: HELP:Headshot for only head! - JaydenJason - 02.07.2015

Quote:
Originally Posted by Mijata
Посмотреть сообщение
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid,bodypart)
{
if(issuerid != INVALID_PLAYER_ID)
    {
if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
 {
if((weaponid == 34 || weaponid == 33) && bodypart == 9)
                {
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid, "~r~Head shot!", 3000, 3);
GameTextForPlayer(playerid, "~r~Head shot!", 3000, 3);
                }
else return PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
}else {GameTextForPlayer(issuerid, "~r~Team killing is not allowed!", 3000, 3);}
}
return 0;
}
headshot is not only for head ??
u didnt specify the body part


Re: HELP:Headshot for only head! - Mijata - 02.07.2015

bodypart 9?


Re: HELP:Headshot for only head! - J0sh... - 02.07.2015

Bodypart 9 is the head.
https://sampwiki.blast.hk/wiki/Body_Parts


Re: HELP:Headshot for only head! - Lynn - 02.07.2015

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid,bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
        {
            if(weaponid == 34 || weaponid == 33 && bodypart == 9)
            {
                SetPlayerHealth(playerid, 0.0);
                GameTextForPlayer(issuerid, "~r~Head shot!", 3000, 3);
                GameTextForPlayer(playerid, "~r~Head shot!", 3000, 3);
            }
            else return PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
        }
        else {GameTextForPlayer(issuerid, "~r~Team killing is not allowed!", 3000, 3);}
    }
    return 0;
}



Re: HELP:Headshot for only head! - WaJeeH - 03.07.2015

Use this :
Quote:

#include <a_samp>


#define BODY_PART_TORSO 3
#define BODY_PART_GROIN 4
#define BODY_PART_LEFT_ARM 5
#define BODY_PART_RIGHT_ARM 6
#define BODY_PART_LEFT_LEG 7
#define BODY_PART_RIGHT_LEG 8
#define BODY_PART_HEAD 9

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:Health;
new killerid;
GetPlayerHealth(playerid,Health);
if(issuerid != INVALID_PLAYER_ID)
{
switch(weaponid)
{
case 34:
{
switch(bodypart)
{
case BODY_PART_TORSO:
{
SetPlayerHealth(playerid,Health-10.0);
}
case BODY_PART_GROIN:
{
SetPlayerHealth(playerid,Health-15.0);
}
case BODY_PART_LEFT_ARM:
{
SetPlayerHealth(playerid,Health-5.0);
}
case BODY_PART_RIGHT_ARM:
{
SetPlayerHealth(playerid,Health-5.0);
}
case BODY_PART_LEFT_LEG:
{
SetPlayerHealth(playerid,Health-20.0);
}
case BODY_PART_RIGHT_LEG:
{
SetPlayerHealth(playerid,Health-20.0);
}
case BODY_PART_HEAD:
{
GameTextForPlayer(killerid,"~h~~g~Headshot!",3500, 4);
GameTextForPlayer(playerid,"~h~~r~Headshot!",3500, 4);
SetPlayerHealth(playerid,0.0);

}
}
}
}
}
return 1;
}




Re: HELP:Headshot for only head! - Lynn - 03.07.2015

Quote:
Originally Posted by WaJeeH
Посмотреть сообщение
Use this :
Why would he use that?
All he wants is for the headshot to be registered.
Not every body part with specific damage.


Re: HELP:Headshot for only head! - WaJeeH - 03.07.2015

Quote:
Originally Posted by Lynn
Посмотреть сообщение
Why would he use that?
All he wants is for the headshot to be registered.
Not every body part with specific damage.
Open your eyes and see what he said.....He need headshot only for head..So i gave him all the script he can take help from it or can use it......


Re: HELP:Headshot for only head! - ZachKnoxx - 03.07.2015

Quote:
Originally Posted by WaJeeH
Посмотреть сообщение
Open your eyes and see what he said.....He need headshot only for head..So i gave him all the script he can take help from it or can use it......
That is terrible spacing. You should probably fix that.


Re: HELP:Headshot for only head! - HeLiOn_PrImE - 03.07.2015

Quote:
Originally Posted by ZachKnoxx
Посмотреть сообщение
That is terrible spacing. You should probably fix that.
He used [quote] instead of [code].
Anyway, I agree. If someone wants to help him, good.
But offer him a clear solution to his problem.