IsPlayerInArea problem
#1

How can i make this work? I mean in which way to write it to be equal with this form?
pawn Код:
if (!IsPlayerInArea(*******)
{
//sth to be done everywhere BUT when player is in this area
}
Cause in this way, the ! does nothing.
Reply
#2

Why don't you use https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint ?
Reply
#3

I think you didnt understand what i asked for. I want to create an area, and say if a player IS NOT in this area and spawns minigun with hack, he loses all his weapons.
Reply
#4

pawn Код:
forward IsPlayerInArea(playerid, BX,BY,BZ,BA);
public IsPlayerInArea(playerid, BX,BY,BZ,BA)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerID, X, Y, Z);
    if(X >= BX && X <= BZ && Y >= BY && Y <= BA)
    {
        return 1;
    }
    return 0;
}
hope that is what you needed.

pawn Код:
if(!IsPlayerInArea(playerid,X,Y,Z,A)
{
    // do code here
}
Reply
#5

Thanks a lot man, what you wrote is not correct but you gave me the idea!
Reply
#6

If you ever want to see the syntax, type the function and the opening ( and wait a second. The parameters will pop up in a box*. It can be a bit buggy in pawno and is a bit better in Notepad++. Not sure about other editors.

* This is only designed to work for native functions (i.e. functions default to SA-MP) but library writers can use a little trick called 'fake natives' to make their custom functions show up.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)