SA-MP Forums Archive
[Help] isPlayerinArea - 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] isPlayerinArea (/showthread.php?tid=268977)



[Help] isPlayerinArea - Jimbo01 - 14.07.2011

Hi all

I'm using this https://sampwiki.blast.hk/wiki/Areacheck

Код:
   public isPlayerInArea()
   {
       new Float:X, Float:Y, Float:Z; //We use this to store player position
       for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
       {
           GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
           if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37)
           /* This line is the important one!. Here, is where you change those numbers, by the ones
           you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
           doesnt matter*/
           {
               SetPlayerHealth(i, -999999.9); //This will ensure, that our player gets killed if he tries to enter
           }
       }
   }
I want it should work only if a player is gWanted how can i make it ? Now it kills all if he/she enters the area


Re: [Help] isPlayerinArea - Toreno - 14.07.2011

Did you set the timer as they said in wiki?


AW: [Help] isPlayerinArea - Jimbo01 - 14.07.2011

yes all... Now it should kill everyone if they enter the area (didn't tested but i want it should only kill if player is wanted "gWanted"


Re: [Help] isPlayerinArea - Toreno - 14.07.2011

Oh, that's what you meant, my bad then and here you go, change the old isPlayerInArea to this.
pawn Код:
public isPlayerInArea() {
    New Float:X, Float:Y, Float:Z;
    For(new i=0; i < MAX_PLAYERS; i++) {
        GetPlayerPos(i, X, Y, Z);
        if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37 && gWanted[playerid] == 1) SetPlayerHealth(i, -999999.9);
    }
}



Re: [Help] isPlayerinArea - Rafa - 14.07.2011

No need here return ? :/
pawn Код:
if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37 && gWanted[playerid] == 1) return SetPlayerHealth(i, -999999.9);
sorry if im wrong im just asking...


Re: [Help] isPlayerinArea - Toreno - 14.07.2011

No, because it won't return anything under this if, so it doesn't matter actually.


Re: [Help] isPlayerinArea - Adil - 14.07.2011

pawn Код:
if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37 && PlayerInfo[i][gWanted])

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37 && gWanted[playerid] == 1) SetPlayerHealth(i, -999999.9);[/pawn]
I'm sure he uses gWanted as the numbers of his wanted stars, so that will only work if he is only one star wanted.


Re: [Help] isPlayerinArea - Adil - 14.07.2011

Quote:
Originally Posted by Adil
Посмотреть сообщение
I'm sure he uses gWanted as the numbers of his wanted stars
You didn't.


AW: [Help] isPlayerinArea - Jimbo01 - 14.07.2011

thanks all but i didnt worked.. So i tested the code from wikipedia

Код:
   public isPlayerInArea()
   {
       new Float:X, Float:Y, Float:Z; //We use this to store player position
       for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
       {
           GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
           if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37)
           /* This line is the important one!. Here, is where you change those numbers, by the ones
           you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
           doesnt matter*/
           {
               SetPlayerHealth(i, -999999.9); //This will ensure, that our player gets killed if he tries to enter
           }
       }
   }
and saw this dont works too....


Re: [Help] isPlayerinArea - Toreno - 14.07.2011

Quote:
Originally Posted by Adil
Посмотреть сообщение
You didn't.
I did, you meant... with how much stars the player owns, but actually it doesn't matter know, he says it doesn't work.