Help OnPlayerTakeDamage
#1

hello I have an error I did not detect any bodypart when he shot the head says he shot the bodypart 1 when it is not, I put a printf to see what bodypart I hit and always throws me 1, I can say that I shot all body parts and throws, this I did because I have a headshot system that does not work, I do not have any fs that affect the OnPlayerTakeDamage and no include,
Does anyone know why it is?

Code:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    new 
string[500];
    new 
Silah1 GetPlayerWeapon(issuerid);
    new 
weaponName[32];
    
GetWeaponName(weaponidweaponNamesizeof (weaponName));
    
printf("%s bodypart %d",GetName(issuerid),bodypart);
    if(
issuerid != INVALID_PLAYER_ID)
    {
        if(
weaponid == 34)
        {
            if(
bodypart == 9)
            {
                if(
HeadShot[playerid] == false)
                {
                    
CountHeadShots[issuerid]++;
                    
PlayerPlaySound(issuerid42010.00.00.0);
                    
format(stringsizeof(string),"~n~~n~~r~Headshot by %s! ",GetName(issuerid));
                    
GameTextForPlayer(playeridstring40003);
                    
format(string2sizeof(string2),"~n~~n~~g~headshot ~n~~g~Combo x %d!",CountHeadShots[issuerid]);
                    
GameTextForPlayer(issueridstring240003);
                    
SetPlayerHealth(playerid0.0);
                    
PlayerInfoSQL[issuerid][accountMonedas] = PlayerInfoSQL[issuerid][accountMonedas] +1;
                    
PlayerInfoSQL[issuerid][accountHeadShot]++;           
                    switch(
CountHeadShots[issuerid])
                    {
                        case 
15format(string2sizeof(string2), "%s~r~ HeadShot x 15",GetName(issuerid)) && TextDrawSetString(WomboComboHedShotxd,string2) && TextDrawShowForAll(WomboComboHedShotxd) && SetTimer("EliminarWomboCombo",5000,0);
                    }
                }
            }
        }
    
//===========================================================
    
PlayerPlaySound(issuerid178020.00.00.0);
    
ConDano[issuerid]=1;
    
TimerDano[issuerid]=10;
    
ConDano[playerid]=1;
    
TimerDano[playerid] =10;
    
DamageHP[0][issuerid][playerid] += amount;
    if(
DamageHP[0][issuerid][playerid] > 19Asistencia[issuerid] = playerid;
    if(
GInfo[playerid][gangmember] != 0)
    {
            if(
GInfo[playerid][gangname] == GInfo[issuerid][gangname] && GInfo[playerid][gangfire]==&& EnDuelo[playerid] == && Minijuego[playerid]==&& EnEventos[playerid]==0)
            {
                    
GameTextForPlayer(issuerid"~n~~n~~n~~r~~h~No dispares ~n~~r~~h~a miembros ~w~~h~de tu clan!"50004);
                    new 
Float:health;
                    
DamageKick[playerid]=30;
                    
GetPlayerHealth(playeridhealth);
                    
SetPlayerHealth(playeridhealth);
            }
    }
    if(
Silah1 == 24)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+46;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+46;
            }
    }
    if(
Silah1 == 25)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+20;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+20;
            }
    }
    if(
Silah1 == 27)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+39;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+39;
            }
    }
    if(
Silah1 == 31)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+9;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+9;
            }
    }
    if(
Silah1 == 34)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+41;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+41;
            }
    }
    if(
Silah1 == 28)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+9;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+9;
            }
    }
    if(
Silah1 == 33)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+24;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+24;
            }
    }
    if(
Silah1 == 29)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+8;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+8;
            }
    }
    if(
Silah1 == 22)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+8;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+8;
            }
    }
    if(
Silah1 == 23)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+13;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+13;
            }
    }
    if(
Silah1 == 26)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+30;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+30;
            }
    }
    if(
Silah1 == 32)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+9;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+9;
            }
    }
    if(
Silah1 == 38)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+30;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+30;
            }
    }
    if(
Silah1 == 36)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+30;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+30;
            }
    }
    if(
Silah1 == 35)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+30;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+30;
            }
    }
    if(
Silah1 == 30)
    {
            
PlayerInfoSQL[issuerid][accountDamageContador]=PlayerInfoSQL[issuerid][accountDamageContador]+5;
            if(
OperationInfo[issuerid][EnOperation7]==true)
            {
            
OperationInfo[issuerid][DAMAGE]=OperationInfo[issuerid][DAMAGE]+5;
            }
    }
        if(
weaponid == 49 && InfoCorredor[playerid][ENCORRE]==false)  //Si lo daсa con un vehiculo
        
{
            static 
Float:X;
            static 
Float:Y;
            static 
Float:Z;
            
GetPlayerPos(playerid,XY,Z);
            
SetPlayerPos(playerid,X,Y,Z+3);
            
SendClientMessage(playeridamarillo"* El Anti Car Kill te ha salvado de CK (Anti Car Kill)");
            
WarningCKFCA[issuerid]++;
            if(
WarningCKFCA[issuerid]==3)
            {
            
SendClientMessage(issueridCOLOR_RED"* Si continuas haciendo daсo con el vehiculo Las funciones de 'Saltos,Supervelocidad etc' se desactivaran por 5 minutos");
            }
            if(
WarningCKFCA[issuerid]==5)
            {
            
SendClientMessage(issueridCOLOR_RED"* Las funciones del vehiculo 'Saltos,Supervelocidad etc' fueron desactivas por 5 minutos por hacer daсo con el vehiculo");
            
DebugFuncAutos[issuerid]=1;
            
SetTimerEx("ResetFuncAutos"360000false"d"issuerid);
            }
       }
//==================================================
 
    
if(Silah1 == 27 && PlayerInfoSQL[issuerid][Vboom] == 1)
    {
        if(
PlayerInfoSQL[playerid][God] == && PlayerInfoSQL[issuerid][God] == 0)
        {
                  new 
Float:xFloat:yFloat:z;
                
GetPlayerPos(playeridxyz);
                    
CreateExplosion(xyz125.0);
          }
    }
    
        if(
incbug[playerid]==1)
        {
            static 
Float:X;
            static 
Float:Y;
            static 
Float:Z;
            
GetPlayerPos(issuerid,XY,Z);
            
SetPlayerPos(issuerid,X,Y,Z+3);
            
GameTextForPlayer(issuerid"~n~~n~~r~No puedes hacer daсo en esta zona!"30003);
        }
  
        if(
OnDuty[playerid]==1)
        {
            static 
Float:X;
            static 
Float:Y;
            static 
Float:Z;
            
GetPlayerPos(issuerid,XY,Z);
            
SetPlayerPos(issuerid,X,Y,Z+3);
            
GameTextForPlayer(issuerid"~n~~n~~r~No Molestes aun admin ~n~~y~onduty!!"30003);
        }
    if(
PlayerInfoSQL[issuerid][accountVIP] == && Deathshoot[issuerid] == 1)
    {
        if(
PlayerInfoSQL[playerid][God] == && PlayerInfoSQL[issuerid][God] == 0)
        {
            if(
Silah1 == 33)
            {
            
SetPlayerHealth(playerid0);
            
SendClientMessage(playeridCOLOR_VERDE"{ff0000}** Te asesinaron con deathshoot con Country Rifle!");
            
SendClientMessage(issueridCOLOR_VERDE"{ffff00}** Has asesinado con deathshoot con Country Rifle!");
            
PlayerPlaySound(issuerid178020.00.00.0);
            }
        }
    }
          if(
good[playerid]==1)
        {
            if(
limba[playerid]==1)
            {
            
GameTextForPlayer(issuerid"~n~~n~~g~Jugador con godmode!!"30003);
            }
            if(
limba[playerid]==2)
            {
            
GameTextForPlayer(issuerid"~n~~n~~g~Player with godmode!!"30003);
            }
        }
        if(
good[issuerid]==1)
        {
        static 
Float:X;
        static 
Float:Y;
        static 
Float:Z;
        
GetPlayerPos(issuerid,XY,Z);
        
SetPlayerPos(issuerid,X,Y,Z+3);
        
SendMessage(issuerid,0xff0000ff,"No puedes hacer daсo a otros jugador teniendo el godmode activado","You can not hurt other player having activated godmode");
        }
        if(
Silah1 == 27 && PlayerInfoSQL[issuerid][Vboom] == 1)
        {
            if(
PlayerInfoSQL[playerid][God] == && PlayerInfoSQL[issuerid][God] == 0)
            {
                      new 
Float:xFloat:yFloat:z;
                    
GetPlayerPos(playeridxyz);
                    
// Create an explosion at the player's position
                       
CreateExplosion(xyz121.0);
              }
        }
    
        if(
Knife[issuerid] == 1)
        {
            new 
Silah GetPlayerWeapon(issuerid);
            if(
PlayerInfoSQL[playerid][God] == && PlayerInfoSQL[issuerid][God] == 0)
            {
                if(
Silah == 4)
                {
                
SetPlayerHealth(playerid0);
                
SendClientMessage(playeridCOLOR_VERDE"{ff0000}** Te asesinaron con el cuchillo de la muerte!");
                
SendClientMessage(issueridCOLOR_VERDE"{ffff00}** Has asesinado con knife death!");
                
PlayerPlaySound(issuerid178020.00.00.0);
                }
            }
        }
    }
    
/* ================================================ */
    
return 1;

As I said before I put a printf to see that bodypart throws and always throws bodypart 1, when I shoot at any part of the body

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)