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: IsPlayerInArea (
/showthread.php?tid=87584)
IsPlayerInArea -
V1ceC1ty - 21.07.2009
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?
Re: IsPlayerInArea -
arnutisz - 21.07.2009
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.
Re: IsPlayerInArea -
V1ceC1ty - 21.07.2009
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.
Re: IsPlayerInArea -
Grim_ - 21.07.2009
Add the "IsPlayerInArea" function to your script.
Re: IsPlayerInArea -
V1ceC1ty - 21.07.2009
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.
Re: IsPlayerInArea -
Donny_k - 21.07.2009
You are suppose to fill in the parts where he put like "....", "min_X" etc, put your values there.
Re: IsPlayerInArea -
V1ceC1ty - 21.07.2009
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.
Re: IsPlayerInArea -
MadeMan - 21.07.2009
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);
}
}
}
Re: IsPlayerInArea -
V1ceC1ty - 21.07.2009
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.
Re: IsPlayerInArea -
MadeMan - 21.07.2009
Can you show lines 1021 and 1033?