SA-MP Forums Archive
[Only works for id 0] - 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: [Only works for id 0] (/showthread.php?tid=121338)



[Only works for id 0] - Doppeyy - 16.01.2010

pawn Код:
public HeightCheck(playerid)
{
  new Float:x, Float:y, Float:z;
  for(new i = 0; i < GetMaxPlayers(); i++)
    {
        GetPlayerPos(playerid,x,y,z);
        if(z < 90)
        {
         SetPlayerHealth(playerid,0.0);
        }
    }
    return 1;
}
Why does that only work for id 0 ?
And also when i spawn for the first time i die and after that its all good.

Reaver~


Re: [Only works for id 0] - MadeMan - 16.01.2010

pawn Код:
public HeightCheck()
{
    new Float:x, Float:y, Float:z;
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        GetPlayerPos(i,x,y,z);
        if(z < 90)
        {
            SetPlayerHealth(i,0.0);
        }
    }
    return 1;
}



Re: [Only works for id 0] - SuperS82 - 16.01.2010

Try this:
Код:
public HeightCheck(playerid)
{
  new Float:x, Float:y, Float:z;
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    GetPlayerPos(i,x,y,z);
    if(z < 90)
    {
      SetPlayerHealth(i,0.0);
    }
  }
  return 1;
}
And as for the dying when you spawn, well your probably spawning somewhere in an interior, all interior floors are way up in the air... So your most likely above the 90 z limit. Try changing your spawning point to somewhere else or raising your z limit cuz this is gonna kill you every time you enter an interior because you will be way above 90 z when your inside one.


Re: [Only works for id 0] - Doppeyy - 16.01.2010

Quote:
Originally Posted by SuperS82
Try this:
Код:
public HeightCheck(playerid)
{
  new Float:x, Float:y, Float:z;
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    GetPlayerPos(i,x,y,z);
    if(z < 90)
    {
      SetPlayerHealth(i,0.0);
    }
  }
  return 1;
}
And as for the dying when you spawn, well your probably spawning somewhere in an interior, all interior floors are way up in the air... So your most likely above the 90 z limit. Try changing your spawning point to somewhere else or raising your z limit cuz this is gonna kill you every time you enter an interior because you will be way above 90 z when your inside one.
I dont spawn in a interior its on a roof in LV.
And Mademan's way worked already.

Reaver~