IsPlayerInArea
#1

Hi again. I got some trouble with this function, can't really get it to work.

My command:
pawn Код:
if(strcmp(cmd, "/growtomato", true) == 0)
  {
        if(IsPlayerInArea(playerid, 282.254486, 237.957290, 1098.032470, 1032.043579))
        {
            if(FarmerInfo[playerid][pSeed] == 1)
            {
            FarmerInfo[playerid][pSeed] = 0;
                SendClientMessage(playerid, RED, "Tomato seed planted.");
            }
        }
    return 1;
    }
Some stuff I found on wiki:
pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
    return 0;
}
I get these errors:
Код:
(22503) : warning 217: loose indentation
(29158) : warning 219: local variable "X" shadows a variable at a preceding level
(29158) : warning 219: local variable "Y" shadows a variable at a preceding level
(29158) : warning 219: local variable "Z" shadows a variable at a preceding level
(29159) : error 035: argument type mismatch (argument 2)
(29160) : warning 213: tag mismatch
(29160) : warning 213: tag mismatch
(29160) : warning 213: tag mismatch
(29160) : warning 213: tag mismatch
(29158) : warning 203: symbol is never used: "Z"
(29158) : warning 203: symbol is never used: "Y"
(29158) : warning 203: symbol is never used: "X"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Thanks!
Reply
#2

Try this

pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX <= max_x && pX >= min_x && pY <= max_y && pY >= min_y) return 1;
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)