AreaCheck doesn't work.
#1

I am working on a weapon free zone in las venturas. So when a player enters the zone, he will lose his weapons, (if hes currently holding them).

Heres the script; http://pastebin.com/b2qzEp1A

It says for now, to set the players health to 0. This is just for testing, I will make it ResetPlayerWeapon later.

It doesnt work, I can just enter the zone without getting killed. Can someone tell me what I did wrong?

PS: Im not sure if i've inputted the coordinates the way it should, but the area should be including whole las venturas, (not desert, city only..)

Thanks in advance.
Reply
#2

Half that code was wrong, you don't need to get the players location, You just need to check if the player(s) is in that location, just put your coords where i marked it.

pawn Код:
#define FILTERSCRIPT
#include <a_samp>
forward isPlayerInArea();
#if defined FILTERSCRIPT
#else
#endif

public OnGameModeInit()
{
    SetTimer("isPlayerInArea", 1000, 1);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    return 1;
}
public isPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
    {
        if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z); // Fill this in, Coords and such
        {
             SetPlayerHealth(i, 0);
        }
    }
}
Reply
#3

pawn Код:
#define FILTERSCRIPT
#include <a_samp>
forward isPlayerInArea();
#if defined FILTERSCRIPT
#else
#endif

public OnGameModeInit()
{
    SetTimer("isPlayerInArea", 1000, 1);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    return 1;
}
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 <= 2918 && X >= 925 && Y >= 598 && Y <= 2606)
           /* 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, 0);
           }
       }
   }
you mixed up "<" and ">" for the Y coordinate check

edit:
don't use Hashski's version as this will put an "Circile" around a point and won't make a square as you need...
Reply
#4

Great! it works. thank you so much Sascha. I did copy the script from wiki-samp but i guess that one is wrong.
Reply
#5

maybe you also just mixed up the coords at the Y part in the script..
you always need to check which of the coords is the higher and which one is the lower one :P
Reply
#6

Ok now ive got another question, I want to set another zone weapon free too, Ive got the coords already. But how do I add this to the script? x =17 - x =-218 and y =-174 - y=-386
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)