Headshot help
#1

Hello, I need a little help in my headshot system, If it is right i made it, It was working fine without anti team headshot, But when i added that now i can't headshot, If i headshot my teammates they don't lose health thats good but now headshot is not working.
PHP код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && weaponid == 23 && BODY_PART_HEAD == 9)
      {
      if (
gTeam[playerid] == gTeam[issuerid])
      {
      
SetPlayerHealth(playerid, -0);
      
SendClientMessage(issuerid, -1"You can't headshot your teammates");
      }
      else
      {
      
SetPlayerHealth(playerid, -100); 
Did something wrong?
No errors
Reply
#2

BODY_PART_HEAD == 9
Erm, of course it equals to 9! It should be bodypart == 9
Reply
#3

Try this

PHP код:

if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && weaponid == 23 && bodypart == 9)
      {
      if(
gTeam[playerid] == gTeam[issuerid])
      {
      
SetPlayerHealth(playerid0);
      
SendClientMessage(playerid, -1"You can't headshot your teammates");
      }
      else
      {
      
SetPlayerHealth(playerid0); 
Reply
#4

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Try this

PHP код:

if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && weaponid == 23 && bodypart == 9)
      {
      if(
gTeam[playerid] == gTeam[issuerid])
      {
      
SetPlayerHealth(playerid0);
      
SendClientMessage(playerid, -1"You can't headshot your teammates");
      }
      else
      {
      
SetPlayerHealth(playerid0); 
Undefined symbol "bodypart"
Reply
#5

Quote:
Originally Posted by SaiyanZ
Посмотреть сообщение
Undefined symbol "bodypart"
Also try upgrading your files to the latest samp version.
Reply
#6

Quote:
Originally Posted by TopShooter
Посмотреть сообщение
You need the a_samp include version which has the "BodyPart"
None does.

What callback is this? OnPlayerTakeDamage?

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && weaponid == 23 && BODY_PART_HEAD == 9)
    {
    	if (gTeam[playerid] == gTeam[issuerid])
     	{
      		SetPlayerHealth(playerid, -0);
        	SendClientMessage(issuerid, -1, "You can't headshot your teammates");
         }
         else
         {
         	SetPlayerHealth(playerid, -100);
         }
    }
}
Reply
#7

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
None does.

What callback is this? OnPlayerTakeDamage?
Yes, Its OnPlayerTakeDamage.
Reply
#8

I have edited my last post. Check if works.
Reply
#9

Try changing your whole code with this:

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {  
         if(
weaponid == 34 || weaponid == 23)
         {  
            if(
bodypart == 9
              { 
                  if(
gTeam[playerid] == gTeam[issuerid]) 
                  { 
                      
SetPlayerHealth(playerid0); 
                      
SendClientMessage(playerid, -1"You can't headshot your teammates"); 
                  } 
                  else 
                 { 
                      
SetPlayerHealth(playerid0);  
                  }
              }
          }
    }                  
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)