18.04.2018, 19:05
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:
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
Does anyone know why it is?
Code:
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new string[500];
new Silah1 = GetPlayerWeapon(issuerid);
new weaponName[32];
GetWeaponName(weaponid, weaponName, sizeof (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(issuerid, 4201, 0.0, 0.0, 0.0);
format(string, sizeof(string),"~n~~n~~r~Headshot by %s! ",GetName(issuerid));
GameTextForPlayer(playerid, string, 4000, 3);
format(string2, sizeof(string2),"~n~~n~~g~headshot ~n~~g~Combo x %d!",CountHeadShots[issuerid]);
GameTextForPlayer(issuerid, string2, 4000, 3);
SetPlayerHealth(playerid, 0.0);
PlayerInfoSQL[issuerid][accountMonedas] = PlayerInfoSQL[issuerid][accountMonedas] +1;
PlayerInfoSQL[issuerid][accountHeadShot]++;
switch(CountHeadShots[issuerid])
{
case 15: format(string2, sizeof(string2), "%s~r~ HeadShot x 15",GetName(issuerid)) && TextDrawSetString(WomboComboHedShotxd,string2) && TextDrawShowForAll(WomboComboHedShotxd) && SetTimer("EliminarWomboCombo",5000,0);
}
}
}
}
//===========================================================
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
ConDano[issuerid]=1;
TimerDano[issuerid]=10;
ConDano[playerid]=1;
TimerDano[playerid] =10;
DamageHP[0][issuerid][playerid] += amount;
if(DamageHP[0][issuerid][playerid] > 19) Asistencia[issuerid] = playerid;
if(GInfo[playerid][gangmember] != 0)
{
if(GInfo[playerid][gangname] == GInfo[issuerid][gangname] && GInfo[playerid][gangfire]==1 && EnDuelo[playerid] == 0 && Minijuego[playerid]==0 && EnEventos[playerid]==0)
{
GameTextForPlayer(issuerid, "~n~~n~~n~~r~~h~No dispares ~n~~r~~h~a miembros ~w~~h~de tu clan!", 5000, 4);
new Float:health;
DamageKick[playerid]=30;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health);
}
}
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,X, Y,Z);
SetPlayerPos(playerid,X,Y,Z+3);
SendClientMessage(playerid, amarillo, "* El Anti Car Kill te ha salvado de CK (Anti Car Kill)");
WarningCKFCA[issuerid]++;
if(WarningCKFCA[issuerid]==3)
{
SendClientMessage(issuerid, COLOR_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(issuerid, COLOR_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", 360000, false, "d", issuerid);
}
}
//==================================================
if(Silah1 == 27 && PlayerInfoSQL[issuerid][Vboom] == 1)
{
if(PlayerInfoSQL[playerid][God] == 0 && PlayerInfoSQL[issuerid][God] == 0)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 12, 5.0);
}
}
if(incbug[playerid]==1)
{
static Float:X;
static Float:Y;
static Float:Z;
GetPlayerPos(issuerid,X, Y,Z);
SetPlayerPos(issuerid,X,Y,Z+3);
GameTextForPlayer(issuerid, "~n~~n~~r~No puedes hacer daсo en esta zona!", 3000, 3);
}
if(OnDuty[playerid]==1)
{
static Float:X;
static Float:Y;
static Float:Z;
GetPlayerPos(issuerid,X, Y,Z);
SetPlayerPos(issuerid,X,Y,Z+3);
GameTextForPlayer(issuerid, "~n~~n~~r~No Molestes aun admin ~n~~y~onduty!!", 3000, 3);
}
if(PlayerInfoSQL[issuerid][accountVIP] == 7 && Deathshoot[issuerid] == 1)
{
if(PlayerInfoSQL[playerid][God] == 0 && PlayerInfoSQL[issuerid][God] == 0)
{
if(Silah1 == 33)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_VERDE, "{ff0000}** Te asesinaron con deathshoot con Country Rifle!");
SendClientMessage(issuerid, COLOR_VERDE, "{ffff00}** Has asesinado con deathshoot con Country Rifle!");
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
}
}
}
if(good[playerid]==1)
{
if(limba[playerid]==1)
{
GameTextForPlayer(issuerid, "~n~~n~~g~Jugador con godmode!!", 3000, 3);
}
if(limba[playerid]==2)
{
GameTextForPlayer(issuerid, "~n~~n~~g~Player with godmode!!", 3000, 3);
}
}
if(good[issuerid]==1)
{
static Float:X;
static Float:Y;
static Float:Z;
GetPlayerPos(issuerid,X, Y,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] == 0 && PlayerInfoSQL[issuerid][God] == 0)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
// Create an explosion at the player's position
CreateExplosion(x, y, z, 12, 1.0);
}
}
if(Knife[issuerid] == 1)
{
new Silah = GetPlayerWeapon(issuerid);
if(PlayerInfoSQL[playerid][God] == 0 && PlayerInfoSQL[issuerid][God] == 0)
{
if(Silah == 4)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_VERDE, "{ff0000}** Te asesinaron con el cuchillo de la muerte!");
SendClientMessage(issuerid, COLOR_VERDE, "{ffff00}** Has asesinado con knife death!");
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
}
}
}
}
/* ================================================ */
return 1;
}