SA-MP Forums Archive
Help me please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me please (/showthread.php?tid=129153)



Help me please - igorpk13 - 21.02.2010

public Health()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gPlayerSpawned[i] == 1)
{
new Float:health;
GetPlayerHealth(i, health);
if(health < 30)
{
if(IsPlayerInAnyVehicle(i))
{
RemovePlayerFromVehicle(i);
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(i, "~r~Voce esta morrendo chame um medico !", 5000, 3);
}
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(i, "~r~Voce esta morrendo chame um medico !", 5000, 3);
}
}
}
}
return 1;
}

i create this command for if the player have 30 or - on life he go to anim crack but he take 20 on life and dont go =X i need help please


Re: Help me please - Born2die - 21.02.2010

Use PAWN tags next time.

Try this, also make sure the function is actually being called.
pawn Код:
public Health()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      if(gPlayerSpawned == 1)
      {
        new Float:health;
        GetPlayerHealth(i, health);
       
              if(health < 30)
        {
                    if(IsPlayerInAnyVehicle(i))
                    {
                        RemovePlayerFromVehicle(i);
                        ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                        GameTextForPlayer(i, "~r~Voce esta morrendo chame um medico !", 5000, 3);
          }
                    else
                    {
                    ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
          GameTextForPlayer(i, "~r~Voce esta morrendo chame um medico !", 5000, 3);
                    }
        }
      }
    }
  }
  return 1;
}



Re: Help me please - igorpk13 - 21.02.2010

C:\DOCUME~1\IGOR\Desktop\FINAL_~1\FINAL_~1\GAMEMO~ 1\crpnew.pwn(1391) : error 033: array must be indexed (variable "gPlayerSpawned")