HELP:Headshot for only head!
#1

Код:
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 ??
Reply
#2

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
Reply
#3

bodypart 9?
Reply
#4

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

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;
}
Reply
#6

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;
}

Reply
#7

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.
Reply
#8

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......
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)