IsPlayerInArea
#1

do i use this

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 want to make it 99999999 health when you enter the zone and show some textdraw but where does SetPlayerHealth and TextDrawShowForPlayer go?
Reply
#2

pawn Код:
SetTimer("InAreaChecker", 1000, 1);

forward InAreaChecker();
public InAreaChecker()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, max_X, min_X, max_Y, min_Y))
    {
      SetPlayerHealth(i, 9999999);
      TextDrawShowForPlayer(...);
    }
    else
    {
      TextDrawHideForPlayer(...);
      SetPlayerHealth(i, 100);
  }
}
I don't know, but this should work. Please tell me if my code is wrong.
Reply
#3

pawn Код:
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1025) : error 004: function "IsPlayerInArea" is not implemented
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1028) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1028) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1032) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1032) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1036) : error 030: compound statement not closed at the end of file (started at line 1023)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

Add the "IsPlayerInArea" function to your script.
Reply
#5

pawn Код:
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1021) : error 025: function heading differs from prototype
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : error 017: undefined symbol "max_X"
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1036) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1036) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1040) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1040) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1045) : error 030: compound statement not closed at the end of file (started at line 1031)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Reply
#6

You are suppose to fill in the parts where he put like "....", "min_X" etc, put your values there.
Reply
#7

this is what ive got

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(1931.533813 <= max_x && 1323.255126 >= min_x && 2036.987426 <= max_y && 1364.370117 >= min_y) return 1;
    return 0;
}

public InAreaChecker()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, 1931.533813, 1323.255126, 2036.987426, 1364.370117))
    {
      SetPlayerHealth(i, 9999999);
      TextDrawShowForPlayer(Textdraw30);
    }
    else
    {
      TextDrawHideForPlayer(Textdraw30);
      SetPlayerHealth(i, 100);
  }
}
and this is what comes out

pawn Код:
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1021) : error 025: function heading differs from prototype
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1036) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1036) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1040) : warning 213: tag mismatch
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1040) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1045) : error 030: compound statement not closed at the end of file (started at line 1031)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

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;
}

public InAreaChecker()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInArea(i, 1931.533813, 1323.255126, 2036.987426, 1364.370117))
        {
            SetPlayerHealth(i, 9999999);
            TextDrawShowForPlayer(i, Textdraw30);
        }
        else
        {
            TextDrawHideForPlayer(i, Textdraw30);
            SetPlayerHealth(i, 100);
        }
    }
}

Reply
#9

with mademans code i get these now

pawn Код:
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1021) : error 025: function heading differs from prototype
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jake\Desktop\SAMP-S~1\GAMEMO~1\DMA.pwn(1033) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Can you show lines 1021 and 1033?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)