Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
//Chaleco y Vida en la cabeza
new Float:Vida;
GetPlayerHealth(playerid, Vida);
if(Vida < VidaB[playerid])
{
SetPlayerAttachedObject(playerid, 5, 1240, 1, 0.797953, 0.070644, 0.001249, 0.521487, 89.103843, 0.000000, 1.000000, 1.000000, 1.000000);//Corazon ID
SetTimerEx("TimeVidayArmadura",2000,0,"d",playerid);
}
new Float:Chaleco;
GetPlayerArmour(playerid, Chaleco);
if(Chaleco < ChalecoB[playerid])
{
SetPlayerAttachedObject(playerid, 5, 1242, 1, 0.797953, 0.070644, 0.001249, 0.521487, 89.103843, 0.000000, 1.000000, 1.000000, 1.000000); //Chaleco ID
SetTimerEx("TimeVidayArmadura",2000,0,"d",playerid);
}
VidaB[playerid] = Vida;
ChalecoB[playerid] = Chaleco;
//Daсos colatarales textdraw imagen impacto sound y dmg con ciertas armas
TextDrawShowForPlayer(playerid, DamageTextRojo);
SetTimerEx("TimeDamageText", 100, false, "i", playerid);
//Sounds
if(IsPlayerConnected(issuerid)) PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
if(IsPlayerConnected(playerid)) PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0.0); //5205
//HeadShoot
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)//Head Shoot [4 = Sniper] [9 = en la cabeza = head shoot]
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, 0xFF0000AA, "Has recibido un disparo de Sniper {0000FF}Head Shoot");//Texto para el que muere
TextDrawShowForPlayer(issuerid, KillHeadShoot);//Textdraw del Shoot
GivePlayerMoney(issuerid, 5000);
SetTimerEx("headshootime", 4000, false, "i", issuerid);//Textdraw time Head Shoot!
}
//Daсo Desert
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9)//desert
{
new Float:VidaD;
SetPlayerHealth(playerid, VidaD-70);
SendClientMessage(playerid, 0x00FF00C8, "Impacto Desert{FF0000} -70 de vida");
}
//
#if defined SHOWN_ON_SCOREBOARD
totalDmg[issuerid] += amount;
SetPlayerScore(issuerid, floatround(totalDmg[issuerid]));
#endif
currentHpLoss[0][issuerid][playerid] += amount;
currentHpLoss[1][playerid][issuerid] += amount;
new
nick[MAX_PLAYER_NAME],
buffer[128];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "%s~n~-%i (%s)~n~Damage", nick, floatround(currentHpLoss[0][issuerid][playerid]), weaponName[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
GetPlayerName(issuerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "%s~n~-%i (%s)~n~Damage", nick, floatround(currentHpLoss[1][playerid][issuerid]), weaponName[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
return 1;
}
Tenes una array de 50 elementos (0 al 49) y intentas accesar al elemento 65535 (INVALID_PLAYER_ID).