Szerző Téma: Alap HP jelzőn nem csökken az élet.  (Megtekintve 779 alkalommal)

Alap HP jelzőn nem csökken az élet.
« Dátum: 2015. november 01. - 19:31:07 »
0 Show voters
Sziasztok!
Egy olyan kérdésem lenne hogy ugyebár van ez az alap HP csík. Na most ezzel nekem annyi a bajom hogyha pl leugrok egy magas épületről tehát sérülük akkor az alap hp jelzőn lévő csík nem csökken :(
Hogyan lehetne megoldani hogy működjön?
Ha sérülök akkor ezt írja a logba:
 
[20:25:04] [debug] Run time error 4: \"Array index out of bounds\"
[20:25:04] [debug]  Accessing element at index 65535 past array upper bound 200
[20:25:04] [debug] AMX backtrace:
[20:25:04] [debug] #0 001a1380 in ?? (0x0000ffff, 0x00000001) from <unknown>
[20:25:04] [debug] #1 0002d9f8 in ?? (0x00000010, 0x0000ffff, 0x00000036, 0x43250000, 0x00000003) from <unknown>
[20:25:04] [debug] #2 0002bfb8 in public OnPlayerTakeDamage (0x00000010, 0x0000ffff, 0x43250000, 0x00000036, 0x00000003) from <unknown>
[20:25:04] [death] Jim Toretto died 54
[20:25:04] [debug] Run time error 4: \"Array index out of bounds\"
[20:25:04] [debug]  Accessing element at index 65535 past array upper bound 200
[20:25:04] [debug] AMX backtrace:
[20:25:04] [debug] #0 001a1380 in ?? (0x0000ffff, 0x00000001) from <unknown>
[20:25:04] [debug] #1 0002d9f8 in ?? (0x00000010, 0x0000ffff, 0x00000036, 0x40533334, 0x00000003) from <unknown>
[20:25:04] [debug] #2 0002bfb8 in public OnPlayerTakeDamage (0x00000010, 0x0000ffff, 0x40533334, 0x00000036, 0x00000003) from <unknown>

 
Előre is köszönöm!
« Utoljára szerkesztve: 2015. november 01. - 20:34:41 írta Jim Toretto »

Alap HP jelzőn nem csökken az élet.
« Válasz #1 Dátum: 2015. november 01. - 22:02:23 »
0 Show voters
Másold be az OnPlayerTakeDamage részt.

Alap HP jelzőn nem csökken az élet.
« Válasz #2 Dátum: 2015. november 02. - 08:27:06 »
0 Show voters
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    OnPlayerHit(damagedid, playerid, bodypart, weaponid, amount);
return 1;
}
stock OnPlayerHit(playerid, attacker, damageType, Float:amount, bodypart)
{
if(damageType == DAMAGE_VEHICLE)
return 0;
if(IsPlayerNPC(playerid) || Ajtozott[playerid] > 0 || AdminDuty[playerid] || Warozott[playerid] >= UnixTime || NoDamage[playerid] || SpawnVedelem[playerid]
|| PlayerVehicle[playerid] != NINCS && ArmoredVehicle[PlayerVehicle[playerid]]
|| attacker != INVALID_PLAYER_ID && ( NemMozoghat(attacker) || AdminDuty[attacker] )
)
return 0;
new Float:damage;
if(0 <= damageType < WEAPON_DAMAGE_TYPES) switch(CustomDamage[damageType][wType])
{
case DAMAGE_DEFAULT, DAMAGE_NEUTRAL:
   damage = amount;
case DAMAGE_OVERWRITE:
   damage = CustomDamage[damageType][wDamage];
case DAMAGE_MULTIPLIER:
   damage = amount * CustomDamage[damageType][wDamage];
}
if(PajzsNala[playerid] && PlayerSkin[playerid] == 285)
damage *= 0.75;
if(damage <= 0.0)
return 0;
 
LogDamage(LOG_DAMAGE_TAKE, playerid, attacker, damageType, damage);
if(22 <= damageType <= 38)
{
PlayerInfo[playerid][pLoves] = UnixTime + 120;
PlayerInfo[playerid][pEllatva] = true;
}
if(attacker != INVALID_PLAYER_ID
&& 22 <= damageType <= 38 && !PLAYER_MARKER_IS_HIDDEN(attacker) && !PlayerMarker[attacker][mHidden] && !IsACop(attacker) && (PlayerInfo[attacker][pHitman] <= 0 && !HitmanDuty[attacker])
&& PlayerMarker[attacker][mLastShoot] != UnixTime
&& (PLAYER_MARKER_WEAPONS_SHOOT(attacker)
   || (WeaponArmed(attacker) == WEAPON_RIFLE || WeaponArmed(attacker) == WEAPON_SNIPER) && GetDistanceBetweenPlayers(attacker, playerid) <= PLAYER_MARKER_RIFLE_DISTANCE)
)
{
PlayerMarker[attacker][mLastShoot] = UnixTime;
switch(PlayerMarker[attacker][mType])
{
   case PLAYER_MARKER_SHOOT:
   {
      if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_SHOOT) > PLAYER_MARKER_MTIME_SHOOT)
         PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_SHOOT;
      else
         PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_SHOOT;
   }
   case PLAYER_MARKER_KILL:
   {
      if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_KILL_SHOOT) > PLAYER_MARKER_MTIME_KILL)
         PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_KILL;
      else
         PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_KILL_SHOOT;
   }
   case PLAYER_MARKER_MKILL:
   {
      if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_MKILL_SHOOT) > PLAYER_MARKER_MTIME_MKILL)
         PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_MKILL;
      else
         PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_MKILL_SHOOT;
   }
   default:
   {
      MarkerAction(attacker, PLAYER_MARKER_SET, PLAYER_MARKER_SHOOT);
   }
}
}
new bool:kikerulve = (random(100)+1) <= Gyemantjai[playerid];
if(kikerulve)
return !Msg(playerid, \"[Gyémánt] Hála az ügyességednek, kikerültél egy találatot\");
if(IsACop(attacker) && Tazer[attacker] && Sokkolt[attacker] == 0 && (WeaponArmed(attacker) == WEAPON_DEAGLE || WeaponArmed(attacker) == WEAPON_SILENCED) && OnDuty[attacker] && GetPlayerState(attacker) == PLAYER_STATE_ONFOOT)
{
new fail, chancetofail = random(100);
switch(chancetofail)
{
   case 0..35: fail = 1;
   default: fail = 0;
}
if(IsPlayerInWater(attacker) || IsPlayerInWater(playerid)) { Msg(attacker, \"Vízben lévőt akarsz lesokkolni? Az áram agyonüt titeket!\"); fail = 1; }
if(GetDistanceBetweenPlayers(attacker, playerid) > 25.0 || IsPlayerNPC(playerid)) { Msg(attacker, \"Nincs a közeledben senki, vagy odáig nem ér el a sokkoló feje!\"); fail = 1; }
if(fail)
{
   SendClientMessage(playerid, COLOR_LIGHTBLUE, \"* Majdnem lesokkolt egy rendőr! Vigyázz!\");
   SendClientMessage(attacker, COLOR_LIGHTBLUE, \"* Nem tudtad lesokkolni a célszemélyt!\");
   Cselekves(attacker, \"lő a sokkolóval, de nem tudja lesokkolni a célszemélyt\", 1);
   GameTextForPlayer(playerid, \"~r~Majdnem lesokkoltak!\", 2500, 3);
   Sokkolt[attacker] = 5;
   return 1;
}
if(Rabol[playerid] == 1) Rabol[playerid] = 0;
if(Tazer[playerid]) Tazer[playerid] = false;
SendClientMessage(playerid, COLOR_LIGHTBLUE, \"* Lesokkolt egy rendőr, és 60 másodpercig megbénultál.\");
SendClientMessage(attacker, COLOR_LIGHTBLUE, \"* Lesokkoltad 60 másodpercre.\");
Cselekves(attacker, \"lő a sokkolóval, és lesokkolja a célszemélyt\", 1);
GameTextForPlayer(playerid, \"~r~Sokkoltak\", 2500, 3);
Bilincs(playerid, 1);
ApplyAnimation(playerid,\"CRACK\",\"crckdeth2\",4.1,0,1,1,1,0);
WeaponArm(playerid);
Sokkolt[attacker] = 15;
return 1;
}
new Float: newhp = Health[playerid], Float: newarmour = Armour[playerid];
if(attacker != INVALID_PLAYER_ID)
{
newarmour -= damage;
if(newarmour < 0)
{
   newhp += newarmour;
   newarmour = 0;
}
}
else
newhp -= damage;
if(!Animban[playerid] && !Paintballozik[playerid] && !Kikepzoben[playerid] && newhp < 15.0 && NextAvailableNoDamage[playerid] < UnixTime && bodypart != BODY_PART_HEAD)
{
NoDamage[playerid] = 3;
newhp = 15.0;
AnimbaRak(playerid);
NextAvailableNoDamage[playerid] = UnixTime + 30;
}
if(damageType == DAMAGE_FALL && !Animban[playerid] && !Paintballozik[playerid] && !Kikepzoben[playerid] && NextAvailableNoDamage[playerid] < UnixTime && damage >= 15.0)
{
NoDamage[playerid] = 3;
newhp -= 50.0;
AnimbaRak(playerid);
NextAvailableNoDamage[playerid] = UnixTime + 30;
}
SetPlayerHealth(playerid, newhp);
SetPlayerArmour(playerid, newarmour);
LastDamage[playerid] = UnixTime;
if(attacker != INVALID_PLAYER_ID)
{
ScriptShoot[playerid] = true;
Shooted[playerid][attacker] = UnixTime;
LastDamager[playerid] = attacker;
LastDamagerDamage[playerid] = UnixTime;
LastDamagerType[playerid] = damageType;
}
if(PlayerSkin[playerid] == 285 && Armour[playerid] >= 100.0) return 0; //SWAT
if(damageType == 34 && Armour[playerid] <= 55.0 && !Paintballozik[playerid]) // sniper = 1 lövés anim
{
SendFormatMessage(playerid, COLOR_LIGHTRED, \"Sérülés: Sniperrel meglőttek, ezért súlyosan megsérültél (#%d)\", PlayerInfo[attacker][pBID]);
Msg(attacker, \"Eltaláltad, ezért nem tud mozogni.\");
AnimbaRak(playerid, false);
new sniplog[128]; format(sniplog, 128, \"%s sniperrel meglőtte őt: %s\", PlayerName(attacker), PlayerName(playerid)); Log(\"Kill\", sniplog);
PlayerInfo[playerid][pLoves] = UnixTime + 600;
PlayerInfo[playerid][pEllatva] = true;
}
else if(damageType == 33 && Armour[playerid] <= 30.0 && !Paintballozik[playerid])
{
if(RifleTalalat[playerid] > 0)
{
   SendFormatMessage(playerid, COLOR_LIGHTRED, \"Sérülés: Többször is meglőttek Riflevel, ezért súlyosan megsérültél (#%d)\", PlayerInfo[attacker][pBID]);
   Msg(attacker, \"Többször is meglőtted Riflevel, ezért súlyosan megsérült.\");
   AnimbaRak(playerid, false);
   new riflelog[128]; format(riflelog, 128, \"%s riflevel animba lőtte őt őt: %s\", PlayerName(attacker), PlayerName(playerid)); Log(\"Kill\", riflelog);
   PlayerInfo[playerid][pLoves] = UnixTime+300;
   PlayerInfo[playerid][pEllatva] = true;
}
RifleTalalat[playerid] = 10;
}
else if(bodypart == BODY_PART_HEAD)
{
if(Paintballozik[playerid])
{
   NoDamage[playerid] = 5;
   if(damageType == 22) PlayerInfo[attacker][pFegyverSkillek][0] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"A Colt45 skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 23) PlayerInfo[attacker][pFegyverSkillek][1] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"A Silenced skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 24) PlayerInfo[attacker][pFegyverSkillek][2] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"A Deagle skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 25) PlayerInfo[attacker][pFegyverSkillek][3] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"A Shotgun skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 27) PlayerInfo[attacker][pFegyverSkillek][5] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"A Combat skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 29) PlayerInfo[attacker][pFegyverSkillek][7] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"Az MP5 skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 30) PlayerInfo[attacker][pFegyverSkillek][8] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"Az AK47 skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   if(damageType == 31) PlayerInfo[attacker][pFegyverSkillek][9] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, \"Az M4 skilled emelkedett \"#PBSKILL_FEJ\" ponttal\");
   FegyverSkillFrissites(attacker);
   Msg(playerid, \"Fejen lőttek, ezért kiestél, hamarosan újraéledsz\");
   Msg(attacker, \"Fejen lőtted, ezért kiesett\");
   new Float:hp; GetPlayerHealth(attacker, hp);
   SetPlayerHealth(attacker, hp+random(100));
   PlayerPlaySound(attacker, 17802, 0.0, 0.0, 0.0);
   SetPlayerHealth(playerid, 0.0);
   return 0;
}
if(!Paintballozik[playerid] && !Kikepzoben[playerid] && !Halal[playerid])
{
   SendFormatMessage(playerid, COLOR_LIGHTRED, \"Fejen lőttek, ezért eszméletedet vesztetted (#%d)\", PlayerInfo[attacker][pBID]);
   Msg(attacker, \"Fejen lőtted, ezért eszméletét vesztette.\");
   PlayerInfo[playerid][pEllatva] = false;
}
if(Harcol[playerid])
   HarcKieses(playerid, \"Fejen lőtték\");
else
   SetPlayerHealth(playerid, 0.0);
tformat(128, \"%s fejen lőtte őt: %s\", PlayerName(attacker), PlayerName(playerid)); Log(\"Kill\", _tmpString);
}
else if(bodypart == BODY_PART_LEFT_LEG || bodypart == BODY_PART_RIGHT_LEG)
{
if(Paintballozik[playerid])
    {
   NoDamage[playerid] = 5;
   if(damageType == 22) PlayerInfo[attacker][pFegyverSkillek][0] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"A Colt45 skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 23) PlayerInfo[attacker][pFegyverSkillek][1] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"A Silenced skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 24) PlayerInfo[attacker][pFegyverSkillek][2] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"A Deagle skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 25) PlayerInfo[attacker][pFegyverSkillek][3] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"A Shotgun skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 27) PlayerInfo[attacker][pFegyverSkillek][5] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"A Combat skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 29) PlayerInfo[attacker][pFegyverSkillek][7] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"Az MP5 skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 30) PlayerInfo[attacker][pFegyverSkillek][8] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"Az AK47 skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   if(damageType == 31) PlayerInfo[attacker][pFegyverSkillek][9] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, \"Az M4 skilled emelkedett \"#PBSKILL_LAB\" ponttal\");
   FegyverSkillFrissites(attacker);
   new Float:hp; GetPlayerHealth(attacker, hp);
   SetPlayerHealth(attacker, hp+random(50));
   Msg(playerid,\"Lábon lőttek, ezért kiestél, hamarosan újraéledsz\");
   Msg(attacker,\"Lábon lőtted, ezért kiesett\");
   SetHealth(playerid, 0.0);
   PlayerPlaySound(attacker, 17802, 0.0, 0.0, 0.0);
   return 0;
}
LabTalalat[playerid] ++;
if(LabTalalat[playerid] >= 2)
{
   SendFormatMessage(playerid, COLOR_LIGHTRED, \"Lábon lőttek, ezért súlyosan megsebesültél (#%d)\", PlayerInfo[attacker][pBID]);
   Msg(attacker, \"Lábon lőtted, ezért megsebesült.\");
   if(!AdminDuty[attacker] && !Harcol[attacker] && !Paintballozik[attacker] && !Kikepzoben[attacker] && !Halal[attacker])
   {
      PlayerInfo[attacker][pOlesIdo] +=K_LAB_IDO;
      tformat(128, \"%s plusz kórház jail ideje %d másodpercre nőtt (+\"#K_LAB_IDO\"mp)\", PlayerName(attacker), PlayerInfo[attacker][pOlesIdo]);
      KillLog(_tmpString, 0);
   }
   AnimbaRak(playerid, false);
   PlayerInfo[playerid][pLoves] = UnixTime+300;
   PlayerInfo[playerid][pEllatva] = true;
   LabTalalat[playerid] = 0;
   tformat(128, \"%s lábon lőtte őt: %s\", PlayerName(attacker), PlayerName(playerid)); Log(\"Kill\", _tmpString);
}
}
return 1;
}

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal